Reputation: 876
I am passing lamda function with putting on bundle and navigate it like below;
val bundle = bundleOf().apply {
putParcelable("loadProfilResim",ProfilResimListener(loadProfilResimLambda))
}
findNavController().navigate(R.id.resimSecBottomSheetDialogFragment,bundle)
Here is my Parcelize class that include lamda func.
@Parcelize
class ProfilResimListener(val loadProfilResimLambda: (uri:Uri) -> Unit):Parcelable{
fun onLoad(uri:Uri) = loadProfilResimLambda(uri)
}
I can get this lambda parameter from my dialogfragment. Also I can call this lambda after take a photo with cameraX. But when I want to choose a photo from media storage,as soon as I am getting this error.
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.mesutemre.kutuphanem.auth.profil.ui.ProfilIslemFragment$loadProfilResimLambda$1)
What is the reason of this error that startActivityForResult method? How to solve this?
Upvotes: 1
Views: 115