A
A
Alina Mitrokhina2020-01-13 20:33:47
Android
Alina Mitrokhina, 2020-01-13 20:33:47

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

1 answer(s)
A
AndroidDev2015, 2020-01-14
@fursa08

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

https://developer.android.com/guide/navigation/nav...
https://startandroid.ru/ru/uroki/vse-uroki-spiskom...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question