Is there any way to have one and only one instance of each activity?

后端 未结 8 1434
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 06:41

I\'m finding that in my application, the user can get quite \'nested\' in the various activities that are opened while the user is using the application.

For example

8条回答
  •  情歌与酒
    2020-12-08 07:32

    Add intent Flags as

    Intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP); StartActivity(srcActivity.java, DesiredActivity.class);

    Then at onPause() DesiredActivity

    Add finish(), This did the work for me.

提交回复
热议问题