My problem is this ... I have 3 Activities:
(ActivityA), (ActivityB) and (ActivityC)
From ActivityA to ActivityB I use the following code:
val intent = Intent(this, ActivityB::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
startActivity(intent)
finish()
From ActivityB to ActivityC I also use this code:
val intent = Intent(this, ActivityC::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
startActivity(intent)
finish()
But if I give onBackPressed or go to any other App and return to my App, instead of returning to ActivityC, it goes to ActivityA.