Created
June 6, 2018 09:16
-
-
Save realdm/3c9084189be077dda9b022058b1ae828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toolbar.setNavigationOnClickListener { | |
val upIntent: Intent? = NavUtils.getParentActivityIntent(activity!!) | |
when { | |
upIntent == null -> throw IllegalStateException("No Parent Activity Intent") | |
NavUtils.shouldUpRecreateTask(activity!!, upIntent) -> { | |
TaskStackBuilder.create(activity!!) | |
.addNextIntentWithParentStack(upIntent) | |
.startActivities() | |
} | |
else -> { | |
NavUtils.navigateUpTo(activity!!, upIntent) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment