90 likes | 198 Views
Android activities. What makes an app?. Activities: presentation layer Services: invisible workers Content Providers: databases Intents: message-passing framework Broadcast receivers: broadcast consumers Widgets: components added to home screen
E N D
Android activities CS300
What makes an app? • Activities: presentation layer • Services: invisible workers • Content Providers: databases • Intents: message-passing framework • Broadcast receivers: broadcast consumers • Widgets: components added to home screen • Notifications: signa users without interrupting their current activities CS300
Activity states • Foreground of the screen: active or running. • At top of stack • Lost focus but still visible: paused. • A paused activity is completely alive, but can be killed by the system in extreme low memory situations. • Completely obscured by another activity: stopped. • Retains all state and member information, however, it is no longer visible to the user • If paused or stopped, the system can drop the activity from memory by either asking it to finish, or simply killing its process. CS300
Configuration changes • It will cause your current activity to be destroyed going through the normal activity lifecycle process of onPause(), onStop(), and onDestroy() as appropriate. • If the activity had been in the foreground or visible to the user, once onDestroy() is called in that instance then a new instance of the activity will be created, with whatever savedInstanceState the previous instance had generated from onSaveInstanceState(Bundle). CS300
AndroidManifest.xml • heart of the (structure of) android app • lists out all the modules of your android application CS300
What does the manifest do?? • Identify any user permissions the application requires, such as Internet access or read-access to the user's contacts. • Declare the minimum API Level required by the application, based on which APIs the application uses. • Declare hardware and software features used or required by the application, such as a camera, bluetooth services, or a multitouch screen. • API libraries the application needs to be linked against (other than the Android framework APIs), such as theGoogle Maps library.
What does the manifest do?? • The primary task of the manifest is to inform the system about the application's components • You must declare all application components this way: • <activity> elements for activities • <service> elements for services • <receiver> elements for broadcast receivers • <provider> elements for content providers CS300
Resources • http://developer.android.com/reference/android/app/Activity.html • http://developer.android.com/guide/components/fundamentals.html • http://developer.android.com/guide/topics/manifest/manifest-intro.html CS300