android activities 1 cs300. what makes an app? activities: presentation layer services: invisible...

9
Android activities Click icon to add picture 1 CS300

Upload: roy-curtis

Post on 17-Dec-2015

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:

1

CS300

Android activities

Click icon to add picture

Page 2: Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:

CS300

2

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

Page 3: Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:

CS3003

Page 4: Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:

CS300

4

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.

Page 5: Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:

CS300

5

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).

Page 6: Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:

CS300

6

AndroidManifest.xml

heart of the (structure of) android app lists out all the modules of your android

application

Page 7: Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:

7

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.

Page 8: Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:

CS300

8

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