Skip to content

Instantly share code, notes, and snippets.

@PHELAT
Last active May 11, 2019 19:31
Show Gist options
  • Save PHELAT/da6a3576ce1308291104d054443680bd to your computer and use it in GitHub Desktop.
Save PHELAT/da6a3576ce1308291104d054443680bd to your computer and use it in GitHub Desktop.
navigateUp with Bundle!
// This is an extension function on Fragment
import com.phelat.navigationresult.navigateUp
class FragmentB : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
anotherButton.setOnClickListener {
val bundle = Bundle().apply {
putBoolean(IS_LOG_IN_SUCCESSFUL, true)
}
navigateUp(FragmentA.REQUEST_CODE, bundle)
}
}
companion object {
const val IS_LOG_IN_SUCCESSFUL = "is_log_in_successful"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment