Different States of an Android Activity

+139 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 1
Oldest  Newest  Rating
0 Chiagozie Ogbonna · April 23, 2017
AWESOME! thanks.
0 Ankit Agarwal · April 23, 2017
Hi Bucky,

I have recently started to go through your tutorials on the youtube channel. I have already completed the first 9 tutorials and I am now on 8th where we are talking about logs. well I have running all the changes in the AVD and everything was working fine. but now when I embedded changes for logs, I came to notice there are logs being printed even though the app is showing on the AVD manager.

Can you help me on this?/images/forum/upload/2017-02-28/45881698cd796b14a4b2c21a9773c41f.png
0 ANIL TÜFEKÇİ · April 23, 2017
Thanks
0 Guangyu Hu · April 23, 2017
Thank you very much. It's pretty sweet for new comers like me.
0 Alex Gi · April 23, 2017
Thank for your great post.
I have been able to create my first Android app after reading, and in addition, I would like to suggest everybody to check out http://quizbucket.org/quiz/android for android quiz and interview questions, it may be helpful for one who is preparing for a job interview
0 Aashish Kumar · April 23, 2017
Hello Bucky, Actually i'm on Gestures tutorial no. 21 and i'm stuck with my Android Studio because the code is compiling properly but when i try to run it on the Android Virtual Emulator it says app has stopped! Have a look and please try to resolve it ASAP.../images/forum/upload/2017-01-26/41a42e9571ad75503a465e22c61d312f.png/images/forum/upload/2017-01-26/88861bea1c4b6e8bdfdb8f97259ad32c.png

package com.aashish.loginapp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.app.*;
import android.view.*;
import android.widget.*;
import android.support.v4.view.GestureDetectorCompat;

public class MainActivity extends AppCompatActivity implements GestureDetector.OnGestureListener,GestureDetector.OnDoubleTapListener {

    private GestureDetectorCompat gd;
    private TextView t1=(TextView)findViewById(R.id.text);
   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       Button b1=(Button)findViewById(R.id.button);
       t1.setText("cOOL");
       this.gd=new GestureDetectorCompat(this,this);
       gd.setOnDoubleTapListener(this);
       b1.setOnClickListener(
               new Button.OnClickListener() {
                   @Override
                   public void onClick(View view) {
                       TextView t1=(TextView)findViewById(R.id.text) ;

                       t1.setText("Login Successful!");
                   }
               }
       );
       b1.setOnLongClickListener(
               new Button.OnLongClickListener() {
                   public boolean onLongClick(View v) {
                       TextView t1=(TextView)findViewById(R.id.text) ;

                       t1.setText("That was a Long One!");
                       return true;
                   }
               }
       );

   }

   @Override
   public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
       t1.setText("cOOL tap");
       return true;
   }

   @Override
   public boolean onDoubleTap(MotionEvent motionEvent) {
       t1.setText("cOOL dtap[");

       return true;
   }

   @Override
   public boolean onDoubleTapEvent(MotionEvent motionEvent) {
       t1.setText("cOOL dtap2");
       return true;
   }

   @Override
   public boolean onDown(MotionEvent motionEvent) {
       t1.setText("cOOL down");
       return true;
   }

   @Override
   public void onShowPress(MotionEvent motionEvent) {
       t1.setText("cOOL press");
   }

   @Override
   public boolean onSingleTapUp(MotionEvent motionEvent) {
       t1.setText("cOOL tapup");
       return true;
   }

   @Override
   public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1) {
       t1.setText("cOOL Scroll");
       return true;
   }

   @Override
   public void onLongPress(MotionEvent motionEvent) {
       t1.setText("cOOL longPress");
   }

   @Override
   public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1) {
       t1.setText("cOOL Fling");
       return true;
   }
}
0 Utsav Rai · January 19, 2017
good :)
0 oye olalekan · January 19, 2017
:sick:
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 Osama Bin Zafar · December 22, 2016
hi there!!
              Can any one tell me where can i find all the source codes, 
i am following android tutorials by bucky , the 87 Video tutorial series ..
thanks in advance 

Java / Android Development

118,022 followers
About

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

Links
Moderators
Bucky Roberts Administrator