Wednesday, 31 October 2018

How to finish several SingleInstance Activities?

I have several activities with launchMode SingleInstance. On log out i want to finish all activities and open launchScreen.

val intent = Intent(context, LauncherActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
(context as AppCompatActivity).finishAffinity()
context.startActivity(intent)

However if i press back at Launcher activity i am forwarded to previously launched activities with singleInstance mode



from How to finish several SingleInstance Activities?

No comments:

Post a Comment