small conformation on activity life cycle

As i am new to Android i need clarify some doubts in Activity Life cycle. I have two activities A and B. I launched first Activity A and i called Activity B from Activity A . So, Activity A went into onPause() state and onStart() state will start for Activity B . Now i pressed BACK key in Acitivity B .So, automatically onResume() method of Activity A will start.

Then what is state of Activity B ?? onPause() or onStop() ? Again if we press BACK key in Activity A what will happen? It goes to Activity B or close the application?


Then what is state of Activity B?

If you hit the back key then, unless you overrode onBackPressed() , the Activity will be finished ( finish() ). -> The Activity state will be destroyed ( onDestroy() ).

Again if we press BACK key in Activity A what will happen?

Activity A will also be finished and the app will close itself (since there is no other Activity in the backstack).


当我们按下按钮时,活动B应该被销毁然后我们再次从活动A返回,因此应用程序应该关闭

链接地址: http://www.djcxy.com/p/65700.html

上一篇: 碎片从onPause到OnResume的生命周期

下一篇: 活动生命周期中的小构象