PreferenceActivity lifecycle

北慕城南 提交于 2019-12-02 05:34:08
Heiko Rupp

As PreferenceActivity is a subclass of Activity, it should follow the same lifecycle. Click on the link you provided and then navigate to Indirect Subclasses or here is the direct http://developer.android.com/reference/android/preference/PreferenceActivity.html

A PreferenceActivity is an Activity and behaves like one. You'll get onPause as soon as it goes to the background, and onStop and onDestroy if it's shut down (or if the configuration changes, like you're changing orientation from portrait to landscape) - they won't typically be called if you're just switching apps.

In general, if you want to apply any changes that were made, you should hook into onPause.

The default implementation of onBackPressed() calls finish() - which results in onDestroy() being called. PreferenceActivity does not override this method, so onDestroy() should also be called.

This can be verified by checking the link you provided, as well as checking out the source of the API as described in http://androidforums.com/application-development/1045-source-code-android-jar.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!