Is the Activity being destroyed because orientation changed or because app is closing?

后端 未结 6 1307
面向向阳花
面向向阳花 2021-01-01 21:12

I have an Activity that starts an AsyncTask. The activity is allowed to show in Portrait or Landscape orientation. When the orientation is

6条回答
  •  北海茫月
    2021-01-01 22:09

    Take a look here for a better understanding of the Android lifecycle: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

    You can use onConfigurationChanged() to detect orientation changes in your Activity. You can use the onDestroy() method to determine when your Activity is about to be killed.

提交回复
热议问题