I'm using jetpack compose. I have two screens, and I want to send a Bitmap from the first one to the second one. So I convert my Bitmap to string and pass it as an argument:
composable(
route = "${NavGraph.FilterScreen.route}/{screenShot}",
arguments = listOf(navArgument("screenShot") {
this.type = NavType.StringType
})
) {
FilterScreen(
innerPadding = padding,
navController = navController,
screenShot = it.arguments?.getString("screenShot")
)
}
and I navigate from the first screen to the second one like this:
navController.navigate(NavGraph.FilterScreen.route + "/${bitmapToString(it)}")
the problem is:
it seems because the string version of Bitmap is so long, the navigation can't handle it and gives the following error:
cannot be found in the navigation graph NavGraph(0x0) startDestination={Destination(0x78d845ec) route=home}
I'm saying that because everything worked when I replaced a small random string with a string containing Bitmap values.
I also tried to use parcellable. But I get the error that parcellable can not have a default value, so we must pass as a string. How can I solve this?