Activity in android is for GUI . If user want to use Textview, button , edit text and other ui component in android app then user has to use activity .
Activity represents user interface .
Activity LifeCycle :
Following is the flow of activity .
OnCreate
OnStart
OnResume
OnPause
OnStop
OnDestroy
OnCreate :
This is the first method call when the system create activity . In this method , we initialize the objects or any other things which only happen once in the entire lifecycle of activity .
Activity represents user interface .
Activity LifeCycle :
Following is the flow of activity .
OnCreate
OnStart
OnResume
OnPause
OnStop
OnDestroy
OnCreate :
This is the first method call when the system create activity . In this method , we initialize the objects or any other things which only happen once in the entire lifecycle of activity .
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); }we have to call super method in onCreate . SetContentView is used to set layout of particular activity .
0 comments:
Post a Comment