Different States of an Android Activity

+126 Bucky Roberts · December 19, 2014
/images/forum/upload/2014-12-19/5a00eeefae97a8d127f621fdc5ad2ff7.png


   @Override
   protected void onStart() {
       super.onStart();
       Log.i(TAG, "onStart");
   }


   @Override
   protected void onResume() {
       super.onResume();
       Log.i(TAG, "onResume");
   }


   @Override
   protected void onPause() {
       super.onPause();
       Log.i(TAG, "onPause");
   }


   @Override
   protected void onStop() {
       super.onStop();
       Log.i(TAG, "onStop");
   }


   @Override
   protected void onRestart() {
       super.onRestart();
       Log.i(TAG, "onRestart");
   }


   @Override
   protected void onDestroy() {
       super.onDestroy();
       Log.i(TAG, "onDestroy");
   }


   @Override
   protected void onSaveInstanceState(Bundle outState) {
       super.onSaveInstanceState(outState);
       Log.i(TAG, "onSaveInstanceState");
   }


   @Override
   protected void onRestoreInstanceState(Bundle savedInstanceState) {
       super.onRestoreInstanceState(savedInstanceState);
       Log.i(TAG, "onRestoreInstanceState");
   }

Post a Reply

Replies

- page 2
Oldest  Newest  Rating
0 Yang Xu · June 15, 2016
love your tutorial!
0 Parimey Patil · November 13, 2016
Hi bucky, When I am trying to run this app on my emulator it is saying that "Unfortunately My Application has stopped" every time. What should  I do?  Pls tell me quickly.
 
0 Enana Alrafidain · December 24, 2015
when i copied the codes (onStarts,onResume,....ect) it appears in the red color and when i tried to put it by my self from the  override methods the i have only 4 choices on the override methods list how can i install all of them  
0 imam afry · November 18, 2016
thanks
0 MD Yousuf Azad Sami · July 15, 2016
Awesome! 
0 Ashwin Athrey · June 19, 2016
I get "Unfortunately myapp has stopped" when i try to run the app on the emulator. What do i do?
0 Jeroen van der Schalie · January 7, 2016
Because I have a AMD processor and not a intel. I can't use HAXM and therefore also not the Android Virtual Device. I'm using genymotion instead. Which works great regarding the emulation. But when I try to use the android device monitor it does not show the oncreate, onstart, etc.. It does show all other activities, but not those logs. Anybody have an idea why? And better yet a solution to do make it work?

Greetz Jeroen
0 Mohammed Tarek · August 30, 2016
Respect :angel:
0 Ashraf Qandeel · August 16, 2015
Thanks alot....
0 Onye Ashikodi · November 10, 2015
Hello Bucky, Thanks for this tutorial and all. Before watching this, Android studio always appear overwhelming. You must have put a lot of effort making this video. But for crying out loud- Why! Why!! Why do you belch to the mic, it's pretty disrespectful.  

Java / Android Development

106,932 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator