Different States of an Android Activity

+136 Bucky Roberts · December 19, 2014

   protected void onStart() {
       Log.i(TAG, "onStart");

   protected void onResume() {
       Log.i(TAG, "onResume");

   protected void onPause() {
       Log.i(TAG, "onPause");

   protected void onStop() {
       Log.i(TAG, "onStop");

   protected void onRestart() {
       Log.i(TAG, "onRestart");

   protected void onDestroy() {
       Log.i(TAG, "onDestroy");

   protected void onSaveInstanceState(Bundle outState) {
       Log.i(TAG, "onSaveInstanceState");

   protected void onRestoreInstanceState(Bundle savedInstanceState) {
       Log.i(TAG, "onRestoreInstanceState");

Post a Reply


- page 4
Oldest  Newest  Rating
0 Shakun Bhalla · July 23, 2015
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 Daniyar Iman-Zhussip · March 18, 2016
nice man
0 Troy Jones · December 19, 2014
I seen this on the developers site.  I believe it mentioned something about only needing to use onStop(), onStart() and onDestroy() as the other one's the activity automatically cycles through.
0 Hossein Mansouri · October 4, 2015
please fix code view problem in Google Chrome
0 oye olalekan · January 19, 2017
0 Direndra Subba · January 14, 2016
???protected void onStart() {
???????Log.i(TAG, "onStart");

Why i get this (?) symbol in the code? 
0 faisal mehmood · January 19, 2017
bucky I am trying to create a virtual device on android studio but it says to install haxm I did it and also activated the crap from BIOS but still it saying the blaw blaw to install haxm
plx get me rid off this situation:angel:
0 nishanth somashekar · July 30, 2015
thanks bucky
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. 


Good luck and happy coding. 
0 sandip ghoshal · July 24, 2015
i am having problem with android avd manager i can not open emulator the android virtual device i am new in this this following error i am getting

D:\Users\sandip\AppData\Local\Android\sdk\tools\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_22
Creating filesystem with parameters:
WARNING: userdata image already in use, changes will not persist!
Size: 69206016
WARNING: cache image already in use, changes will not persist!
Block size: 4096
Blocks per group: 32768
Inodes per group: 4224
Inode size: 256
Journal blocks: 1024
Blocks: 16896
WARNING: SD Card image already in use: D:\Users\sandip\.android\avd\Nexus_5_API_22.avd/sdcard.img
Block groups: 1
Reserved block group size: 7
Created filesystem with 11/4224 inodes and 1302/16896 blocks
emulator: WARNING: Requested RAM size of 512MB is too large for your environment, and is reduced to 384MB.
emulator: device fd:600
HAX is not working and emulator runs in emulation mode
emulator: The memory needed by this AVD exceeds the max specified in your HAXM configuration.
emulator: AVD RAM size = 384 MB
emulator: HAXM max RAM size = 0 MB
emulator: You might want to adjust your AVD RAM size and/or HAXM configuration to run in fast virt mode.
creating window 43 59 329 583
emulator: emulator window was out of view and was recentered

Java / Android Development


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

Bucky Roberts Administrator