Hi guys. I have the `onClickListener`, `itemClickl...
# android
a
Hi guys. I have the
onClickListener
,
itemClicklLisntener
in my
MainActivity.kt
which will response to user onClick activity.
Copy code
Question
But why the view model does not display the value on the fragment?

MainActivity - <https://pastebin.com/4Zp492kn>

QuoteAdapter - <https://pastebin.com/WGSVdh6H>

QuoteViewModel - <https://pastebin.com/X6mv0pH7>

QuoteFragmentLayout -<https://pastebin.com/U4Qcm902>
i
I think you have uploaded wrong file in QuoteAdapter, it's showing MainActivity
a
@Iqbal Ahmed I have updated the file. Thank you for the update.
i
Bro You haven't shared
QuoteFragment
and I don't understand this why are you doing this
Copy code
private fun itemClickListener(quote: Quote) {
        quoteViewModel.quote.value = quote.quote
        quoteViewModel.author.value = quote.author
what I understood, you want to show selected item value on
QuoteFragment
right?
if that so then. may be you can use
Copy code
fragmentBinding.arguments = Bundle().apply{ 
       put(key,value)
}
to pass value to
QuoteFragment
a
Understand @Iqbal Ahmed, I will give it a try. What you're guessing is correct, I want to populate the value into the Fragment. Is there anything I can do in order to help other to understand my question?