Different States of an Android Activity

+138 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 4
Oldest  Newest  Rating
0 Shakun Bhalla · July 23, 2015
Hi,
I also copied the code that you wrote above but the problem that i am facing is that it shows an error in the "TAG", it says that it has a private access in android.support.v4.app.FragmentActivity.

Kindly help me that as i am stuck with this and am not able to proceed further.

Thank you
0 jinu mm · July 7, 2015
Thanks for the Source Code. Just began watching tutorials for   http://www.essayscampus.com  essay writing  
students
0 Colder Coder · July 5, 2015
Hi, thanks for this. I find this thread through the android tutorial, which helps a lot.
0 Colder Coder · July 5, 2015
one question, why cannot I see the onDestroy log when the app is removed through the "square" button.
0 android learner · June 29, 2015
I'm getting error: class, interface or enum expected. What to do?
0 Sandesh uttarwar · June 14, 2015
thank you for this...!
0 Oleg Zigalenko · April 15, 2015
Hi Shreyans Mulkutkar. I had a similar problem and I could not see the log messages. After doing a little research this is what worked for me: 

-Change Log Level from Verbose to Debug
-Change Log Level from Debug to Verbose (basically it just resets it)
  (Make sure that your filter is set to your correct name that you created)
-Then click the Restart button on the left side of the log window (looks like a gray box with green arrow)
It will restart the log and wait about 10 seconds and it should show up. 

If it still does not work then please look at this link as it has more solutions to the same problem. 

http://stackoverflow.com/questions/17432358/android-studio-logcat-nothing-to-show

Good luck and happy coding. 
0 Lasith Niroshan · April 9, 2015
Thanks for codings...:)
+2 Shreyans Mulkutkar · March 18, 2015
I added Log messages to my source code, but don't know why its not throwing onCreate, onStart, etc. messages when my App comes up on my emulater. Even added the log message filter. Still not seeing it. 
Can someone point out what is that thing I'm doing wrong?
Thanks in advance.
+1 Kenny Dexter · March 17, 2015
WOw......and What a Wow

onBucky()

your tutorials are dope , i'm just speechless!:sick:

Java / Android Development

114,108 followers
About

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

Links
Moderators
Bucky Roberts Administrator