kdb*_*lue 7 android android-navigation android-architecture-navigation android-jetpack-compose navigation-compose
我试图将音频文件位置(/storage/emulated/0/Android/media/...
)作为字符串从第一个屏幕传递home_screen
到第二个屏幕detail_screen
,当我正常传递上面的字符串作为参数时,我收到此错误
java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=android-app://androidx.navigation/detail_screen/45193/'/storage/emulated/0/Android/media/com.Slack/Notifications/Slack - Here you go.mp3' } cannot be found in the navigation graph NavGraph(0x0) startDestination={Destination(0x442b361f) route=home_screen}
Run Code Online (Sandbox Code Playgroud)
至于这个地方,如果我传递像这样的字符串Here you go.mp3
,它工作得很好!
我认为 Compose Navigation 无法区分/
路由被解析为 Uris,因此如果您想发送包含特殊字符的字符串,则需要在将Uri.encode()
它们附加到路由之前使用。
导航会在将参数传递到目的地之前自动对其进行解码,因此您无需执行任何操作即可恢复原始 Uri。
归档时间: |
|
查看次数: |
1462 次 |
最近记录: |