Skip to content Skip to sidebar Skip to footer

How To Get Recyclerview Item's Value In Android?

Recyclerview has 4 items i.e; textView1, textView2, EditText1 and Checkbox1. Recyclerview has got 24 rows as well. EditText is invisible on initial stage thenit will be visible onl

Solution 1:

You can register an AdapterDataObserver for the recycler view adapter. For each item in the adapter when it's updated (user updates the EditText), the adapter can call notifyItemChanged(int position, Object payload). the observer will receive the payload in its onItemRangeChanged (int positionStart, int itemCount, Object payload) callback, you can pass whatever you want in the payload object so that you accumulate the values of all the EditTexts.

You can also unregister the observer in your Activity/Fragment onStop by calling unregisterAdapterDataObserver

Post a Comment for "How To Get Recyclerview Item's Value In Android?"