-
Notifications
You must be signed in to change notification settings - Fork 11
Navigation on Activities
Jeziel Lago edited this page Jan 10, 2020
·
3 revisions
On each feature-module on your project, you need to add EntryFlowNav
annotation to inform what activities are the feature-module entry point. The annotation receives a string to identify the activity.
@EntryFlowNav("feature_one")
We recommend that you create constants on navigation module for reuse these strings and prevent typo errors.
@EntryFlowNav(FEATURE_ONE)
class MyFirstOneActivity : AppCompatActivity() { ...
To get the expected intent for the navigation, we need to use a context extension function named start
and who expects the same string used on @EntryFlowNav
.
-
start(FEATURE_ONE)
callstartActivity(...)
-
startForResult(FEATURE_ONE, REQUEST_CODE)
callstartActivityForResult(...)
If you need to pass some arguments to the intent, we will open lambda on second param.
start(FEATURE_TWO) {
putString("key", arg)
}
And then, we can call...
myButton.setOnClickListener {
// redirect to "FEATURE 1"
start(FEATURE_1)
}