There is home icon on app's app bar at top and I want to finish all activities and take user to home page. But, I don't want home page to be re-created.
I have already tried following but it re-creates home page and I don't want it
fun goToHomePage() {
val homeIntent = Intent(activity, HomeActivity::class.java)
homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(intent)
}
<activity
android:name="HomeActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"/>
Re-creating home put pressure on our backend and we don't want that. How to do achieve it?
For HomeActivity use
"singleTop"launchmode.In AndroidManifest:
Reference: https://developer.android.com/guide/topics/manifest/activity-element#lmode
Edit:
From the docs:
Use
onNewIntent()to handle your scenario.