is there anyway posible to get the list of items inside my listadapter, cause the only method to access the list is submitList()
Call getCurrentList() . Quoting the docs: Get the current List - any diffing to present this list has already been computed and dispatched via the ListUpdateCallback. If a null List, or no List has been submitted, an empty list will be returned.
Adapter base class for presenting List data in a RecyclerView , including computing diffs between Lists on a background thread. This class is a convenience wrapper around AsyncListDiffer that implements Adapter common default behavior for item access and counting.
First of all you have to add configChanges mode to activity on your app Manifest file <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android: ...
ListAdapter gets data using a method called submitList() , which submits a list to be diffed against the current list and displayed. This means you no longer have to override getItemCount() because ListAdapter manages the list. In the Activity class, call submitList() on the Adapter and pass in the data list.
Call getCurrentList()
. Quoting the docs:
Get the current List - any diffing to present this list has already been computed and dispatched via the ListUpdateCallback. If a null List, or no List has been submitted, an empty list will be returned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With