Presentation is loading. Please wait.

Presentation is loading. Please wait.

Android intro Building UI #1: interactions. AndroidManifest.xml permissions 2.

Similar presentations


Presentation on theme: "Android intro Building UI #1: interactions. AndroidManifest.xml permissions 2."— Presentation transcript:

1 Android intro Building UI #1: interactions

2 AndroidManifest.xml permissions 2

3 Application Global entry point (*except ContentProvider) Per-process singleton Activity.getApplication() Service.getApplication() Context.getApplicationContext() (+cast) 3

4 Service Long-running off-UI tasks Runs in UI thread Must be stopped =>IntentService to the rescue! (check sources) Often used with AlarmManager for scheduled operations Might be bound to Activity lifecycle 4

5 BroadcastReceiver onReceive() React to some intents Broadcast to all receivers Special case – OrderedBroadcast Static in manifest or dynamic via registerReceiver/unregisterReceiver 5

6 Activity - extras getIntent().getXXXExtra() Bundle b = getIntent().getExtras() Bundle.getString() Bundle.putString()/putInt()/etc startActivityForResult()/onResult() 6

7 Activity - lifecycle onCreate()/onDestroy() (*not guaranteed) onResume()/onPause() onStart()/onStop() onConfigurationChanged() onSaveInstanceState() https://github.com/xxv/android-lifecycle 7

8 Homework – translator app Enter word screen Results screen (with option to re-query) EditText Spinner->TextView+ListView+BaseAdapter AsyncTask! 8

9 AsyncTask doInBackground()/onPostExecute() onPreExecute() Not bound to lifecycle (fixed in loaders) Callback-based (don’t use.get()!) 9


Download ppt "Android intro Building UI #1: interactions. AndroidManifest.xml permissions 2."

Similar presentations


Ads by Google