written 5.8 years ago by | • modified 5.8 years ago |
Subject: Mobile Computing
Difficulty: Medium
Marks: 6 Marks
written 5.8 years ago by | • modified 5.8 years ago |
Subject: Mobile Computing
Difficulty: Medium
Marks: 6 Marks
written 5.8 years ago by | • modified 5.8 years ago |
Let us see commands used in this life cycle taking activity in different states:
- onCreate(Bundle): This is called when the activity first starts up. You can use it to perform one-time initialization such as creating the user interface.
- onStart(): This indicates the activity is about to be displayed to the user.
- onResume(): This is called when your activity can start interacting with the user. This is a good place to start animations and music.
- onPause(): This runs when the activity is about to go into the background, usually because another activity has been launched in front of it.
- onStop(): This is called when your activity is no longer visible to the user and it won‘t be needed for a while. If memory is tight, onStop() may never be called the system may simply terminate your process.
- onRestart(): If this method is called, it indicates your activity is being re displayed to the user from a stopped state.
- onDestroy(): This is called right before your activity is destroyed. If memory is tight, onDestroy() may never be called, the system may simply terminate your process.
- onSaveInstanceState(Bundle): Android will call this method to allow the activity to save per-instance state, such as a cursor position within a text field.
- onRestoreInstanceState(Bundle): This is called when the activity is being reinitialized from a state previously saved by the onSaveInstanceState() method.