Answer the question
In order to leave comments, you need to log in
How to interact with Activity life cycles?
Hello. I just recently started learning android development and there is one question that I can't find an answer to. I have read a lot about the activity life cycle, but how to use them is not described anywhere. Describes mostly examples with Toasts. For example, in my application there are many different activities, and I need that when I click "back" and go back, the old activity is removed from memory. The loop is "onPause() → onStop() → onDestroy()", but how to write it?
Thank you.
Answer the question
In order to leave comments, you need to log in
Redefine them:
@Override
protected void onDestroy(){
super.onDestroy();
Log.d(TAG, "onDestroy");
}
@Override
protected void onStop(){
super.onStop();
Log.d(TAG, "onStop");
}
@Override
protected void onStart(){
super.onStart();
Log.d(TAG, "onStart");
}
@Override
protected void onPause(){
super.onPause();
Log.d(TAG, "onPause");
}
@Override
protected void onResume(){
super.onResume();
Log.d(TAG, "onResume");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question