Answer the question
In order to leave comments, you need to log in
How to pass Listener when using Navigation Component?
Let's say I'm making an application using the Navigation Component. I have a transition from one fragment to another. In the fragment I write findNavController().navigate(R.id.anotherFragment). How can I pass in it a reference to a class that implements the Listener interface?
Answer the question
In order to leave comments, you need to log in
To pass a reference to a class, make it Parcelable or pass the date of the class specified below as an argument:
@Parcelize
data class Param(
val clazz: Class<T>
) : Parcelable
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question