Lecture 3 Flashcards
What are the four different types of components?
Activities - single screen
Services - background processes
Broadcast receivers - to subscribe to events in the android operating system
Content providers - e.g databases
What is the point of a component?
Entry point through which the system or user can enter the app
What are Intents?
Allows an app to call a component from another app
What is an Activity?
Entry point for interacting with the user
Single screen with an interface
Can be launched by other apps is the containing app allows it
What interactions between system and app do activities faciliate?
Tracking user activity (what they are doing)
Tracking previously used processes and content and allowing user to resume
Allowing apps to flow between each other
What is the most important component type?
Activity
When an Activity is launched, what processes are called?
onCreate() -> onStart() -> onResume()
When is onPause() called?
When the activity needs to pause but still be visible, e.g. a semi transparent dialog or window covers it
When a resumed activity is closed, what processes are called?
onPause() -> onStop() -> onDestroy()
When is an activity stopped?
When another Activity is launched. E.g. new window or closing the app
What happens to an Activity when the screen is rotated?
Activity is destroyed then Recreated
State of any view components is retrieved and re-instantiated though
What 6 states can an Activity be in?
Created
Started (visible)
Resumed (visible)
Paused (partially visible)
Stopped (hidden)
Destroyed
When should you save any important information?
Frequently and immediately if possible!
onPause and onStop should be used to save non-critical state info
How do apps run with relation to the linux-like architecture of Android?
Each app is separate linux user with its own VM. Can only access its own files
Which component doesn’t exchange Intents?
Content providers