l Each activity is independent of the others. Each one is implemented as a subclass of the Activity base class.
l An application might consist of just one activity or, like the text messaging application just mentioned, it may contain several.
l One of the activities is marked as the first one that should be presented to the user when the application is launched.
l Each activity is given a default window to draw in.
l As an activity transitions from state to state, it is notified of the change by calls to the following protected methods:
void onCreate(Bundle savedInstanceState)
void onStart()
void onRestart()
void onResume()
void onPause()
void onStop()
void onDestroy()
l All of these methods are hooks that you can override to do appropriate work when the state changes. All activities must implement onCreate() to do the initial setup when the object is first instantiated. Many will also implementonPause() to commit data changes and otherwise prepare to stop interacting with the user.
沒有留言:
張貼留言