In my app, I have four activities Splash -> Activity A -> Login Activity -> Main-Activity. Now when user is authenticated, I wanna clear current task and launch a new task for Main-Activity. For this, I have tried the below code.
var intents = Intent(this@Login,MainActivity::class.java)
intents.addFlags( Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK )
startActivity(intents)
finish()
So when i am in Main-Activity, hits the back button and launch the app again, it first shows (Splash-> Main-Activity) instead of showing Main-Activity directly. I also follow this link Clearing the Launcher Activity from the stack but nothing happened.Please tell me anyone what should i do to make it work..