Friday 23 December 2016

What is Activity and Activity LifeCycle in Android

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 .

@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 .







Thursday 22 December 2016

Wednesday 21 December 2016

Monday 5 September 2016