6. Task (UI Application)
• Runs in one process
– usually!
– There are exceptions
• Stack of activities
• Root activity
– Add
• Display
• push
– Remove
• Hide
• pop
– Activities from other
applications
6
7. Task (UI Application)
• Runs in one process
– usually!
– There are exceptions
• Stack of activities
• Root activity
– Add
• Display
• push
– Remove
• Hide
• pop
– Activities from other
applications
7
9. Context
• Context
– Any application
component
• Activities
• Services
• Content Providers
• Broadcast Receivers
– Generated by Dalvik/ART
• At startup
• Provided as a parameter
9
10. Context
• Abstract Class
– Extended by
• Activity
• Service
• ContentProvider
• …
• Advantages
– Avoids static class
• Disadvantage
– Has to be provided as
parameter
10
11. Activity
• One Window
– Uses all the screen
(usually)
• Contains
– Title
– One component
– One menu
• Activated by the menu
(soft) button
• Extends Activity
11
29. GUI XML example file
• xmlns:android
– Only the root component
– mandatory
• android:layout_width
• android:layout_height
– mandatory
– Values
• fill_parent
• wrap_content
• match_parent
• n px
• n cm
29
30. GUI XML example file
• android:id
– Usage of the component
in the Java code
– @+id/name
• R.id.name
– Example
• @+id/button1
– R.id.button1
30
31. GUI XML example file
• android:id
– Usage of the component
in the Java code
– @+id/name
• R.id.name
– Example
• @+id/button1
– R.id.button1
31
33. Menu
• MENU (soft) button press
• Events
– public boolean
onCreateOptionsMenu (Menu
menu);
– public boolean
onOptionsItemSelected(MenuItem
item);
• Adding a menu
– menu.add (…);
33