alexhelder
07/23/2024, 7:45 PMactivity<Foo> {
val foo:Foo = ?
action = <http://foo.xxx|foo.xxx>
data = <http://foo.xxx|foo.xxx>
}
Ian Lake
07/23/2024, 7:57 PMdataPattern
, which uses the {field}
syntax to fill in part of the data with an argument from your class: https://developer.android.com/guide/navigation/design/activity-destinations#dynamic-argumentsalexhelder
07/23/2024, 8:04 PMIan Lake
07/23/2024, 8:06 PMIan Lake
07/23/2024, 8:07 PMtargetPackage
if you want to restrict it to only your own packagealexhelder
07/23/2024, 8:09 PMalexhelder
07/23/2024, 8:15 PMIan Lake
07/23/2024, 8:16 PMIan Lake
07/23/2024, 8:18 PMIan Lake
07/23/2024, 8:19 PMalexhelder
07/23/2024, 8:36 PMpublic inline fun <reified T : Any> NavGraphBuilder.activity
anywhere, I still am confused about how to do
activity<Foo> {
action = Intent.ACTION_VIEW
data = something in Foo
}
Ian Lake
07/23/2024, 8:37 PMdataPattern = "<http://www.example.com/{name}|www.example.com/{name}>"
where Foo has a field called name
alexhelder
07/23/2024, 9:26 PMfun NavGraphBuilder.viewLinkRoute() {
activity<ViewLinkRoute> {
action = Intent.ACTION_VIEW
dataPattern = "{uri}"
}
}
@Serializable
data class ViewLinkRoute(
val uri: String
)
But get runtime exception No Activity found to handle Intent
… just trying to do:
context.startActivity(
Intent(Intent.ACTION_VIEW, uri)
)
but I’m getting closer. Thanks for your help so far.Ian Lake
07/23/2024, 9:28 PMopenUri
on italexhelder
07/23/2024, 9:40 PM