Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the list of ListAdapter<Model,ViewHolder::class>

is there anyway posible to get the list of items inside my listadapter, cause the only method to access the list is submitList()

like image 214
Eder Padilla Avatar asked Apr 09 '19 23:04

Eder Padilla


People also ask

How do I get list list adapter?

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.

What is list adapter in Android?

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.

How do I use Kotlin list adapter?

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: ...

How does ListAdapter work?

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.


1 Answers

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.

like image 195
CommonsWare Avatar answered Nov 07 '22 01:11

CommonsWare