Presentation is loading. Please wait.

Presentation is loading. Please wait.

Android Programming-Activity Lecture 4. Activity Inside java folder Public class MainActivity extends ActionBarActivity(Ctrl + Click will give you the.

Similar presentations


Presentation on theme: "Android Programming-Activity Lecture 4. Activity Inside java folder Public class MainActivity extends ActionBarActivity(Ctrl + Click will give you the."— Presentation transcript:

1 Android Programming-Activity Lecture 4

2 Activity Inside java folder Public class MainActivity extends ActionBarActivity(Ctrl + Click will give you the base class) ActionBarActivity extends from FragmentActivity FragmentActivity extends from Activity class.

3 Activity LifeCyacle OnCreate() // Overriding it. Layout Launching. //setContentView(R.layout.activity_main) OnStart() onResume() onPause() onStop() onDestroy()

4

5 Android Activity Lifecycle State change Example import android.util.Log;//Login msgs to console. public class MainActivity extends ActionBarActivity { private static final String MY_TAG = “message"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.i(MY_TAG,"onCreate"); }

6 protected void onStart() { super.onStart(); Log.i(MY_TAG, "onStart"); } protected void onResume() { super.onResume(); Log.i(MY_TAG, "onResume"); }

7 protected void onPause() { super.onPause(); Log.i(MY_TAG, "onPause"); } protected void onStop() { super.onStop(); Log.i(MY_TAG, "onStop"); }

8 protected void onDestroy() { super.onDestroy(); Log.i(MY_TAG, "onDestroy"); } To run Activity_main.xml Select Combo box ->EditFilterConfiguration Paste the msg in LogTag Category

9 References http://developer.android.com/reference/andr oid/app/Activity.html#ActivityLifecycle


Download ppt "Android Programming-Activity Lecture 4. Activity Inside java folder Public class MainActivity extends ActionBarActivity(Ctrl + Click will give you the."

Similar presentations


Ads by Google