的onStop()当我preSS后退按钮没有得到所谓的 [英] onStop() not getting called when I press the back button
问题描述
这是正常的。
该文件说。
的调用onStart()和的onStop()方法可被调用多次,作为是可见和隐藏到用户之间的活动交替
"The onStart() and onStop() methods can be called multiple times, as the activity alternates between being visible and hidden to the user"
当我preSS后退按钮的它会回到previous活动这完全覆盖了旧的。
When I press the back button an it will go back to the previous activity which totally covers the old one.
这是怎么回事呢?
推荐答案
您想要的onPause(),没有的onStop()。的onStop称为之前的活性destoryed,当系统内存不足。当用户从导航您的活动远的onPause被调用。参见图在的http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle.
You want onPause(), not onStop(). onStop is called just before the activity is destoryed, when the system is low on memory. onPause is called whenever the user navigates away from your activity. See diagram at http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle.
这篇关于的onStop()当我preSS后退按钮没有得到所谓的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!