DialogFragment displayed from onContextItemSelected doesn't survive onPause/onResume

前端 未结 2 1214
再見小時候
再見小時候 2021-01-02 13:48

I have a DialogDragment which I can show one of two ways:

1) By tapping on a ListView item from its OnItemClickListener

2) By activating a the ListView\'s co

2条回答
  •  忘掉有多难
    2021-01-02 14:31

    I would recommend destroying the dialog on all pauses and recreate in onResume depending on state regardless of how the dialog is invoked. To do otherwise risks a memory leak if the app is killed by the OS in while paused.

    To explicitly answer your question, don't rely on the OS to maintain your app state.

提交回复
热议问题