ANDROID ACTIVITY
Activity Concept Activity is a public class in android application. Activity is connected with user in which activity creates windows or User Interface by setContentView(View)
Activity Cycle Android application activity is managed by activity stack When activity is started, activity is put at the topmost of the stack, activities run already are put behind that stack. When new activity comes, it will be put at the first stack, the topmost stack before will be the second.
4 Situation of Activity Activity/running, if activity is at the top of the stack Pause, if activity is unused, but still exist or visible Stopped, if activity is unused and replaced by other activity. Restart, if activity is paused or stopped and system can drop this activity from memory, when user needs this activity, this activity can be returned to the initial condition (restart)
Lifecycle Activity
3 Looping Entire Lifetime : Activity starts from onCreate() until onDestroy(). It must set to global when defined. Visible Lifetime : Activity starts from onCreate() until onStop(). Foreground Lifetime : Activity starts from onResume() until onPause
The Syntax (Already in Class ext) Public class Activity { protected void onCreate(Bundle savedInstanceState); protected void onStart(); protected void onRestart(); protected void onResume (); protected void onPause(); protected void onStop(); protected void onDestroy(); }
Killable Killable : Apakah memungkinkan bagi sistem untuk mematikan proses host activity atau tidak. Jika killable NO berarti melindungi host activity atau activitynya tidak dimatikan, contoh activitynya : OnCreate OnRestart OnStart OnResume Jika killable YES berarti activity dapat diakhiri/dimatikan, contoh activitynya : OnPause OnStop OnDestroy