Week 1 - Android, Activity Lifecycle, Intents, Widgets Flashcards
Which three methods are called when an app that is running is to be destroyed?
1. onPause() (The app is no longer visible.) 2. onStop() (The Activity is being disposed of by the system.) 3. onDestroy()
Which three methods are called when an app is launched and begins running?
- onCreate()
- onStart()
- onResume()
What are the four states that an activity can be in as part of the Activity Lifecycle?
Running, Paused, Stopped, and Destroyed.
Why does are apps sometimes ‘killed’?
Because it has been terminated (and removed from memory) because the operating system is attempting to reclaim memory for use by other apps.
What is the difference between an an app that has been killed and an app that has been shut down (or destroyed)?
An app that has been killed has been removed from memory to reallocate that memory to other apps. A apps that has been shut down has finished running, and has called the the onPause(), onStop(), and onDestroy() methods prior to being destroyed.
What is the order of priority of the four states in the Activity Lifecycle?
- Running
- Paused
- Stopped
- Destroyed
(From highest to lowest priority.)
What is the purpose of an Implicit Intent?
An Intent is an announcement to the operating system of the intention to perform an action. Depending on the type of the action, the operating system will determine the proper course of action. Intents are frequently used to launch another Activity either in the same app or a different app.
What parameters does an Intent take?
- The current context.
- The class to transition to.
- (Optional) User-supplied data, usually in the form of key-value pairs.