public abstract class RealmBaseAdapter<T extends RealmModel>
extends android.widget.BaseAdapter
CursorAdapter
. This adapter will automatically handle any updates to its data and call BaseAdapter.notifyDataSetChanged()
as appropriate.
The RealmAdapter will stop receiving updates if the Realm instance providing the RealmResults
is closed. Trying to access Realm objects will at this point also result in a IllegalStateException
.
Constructor and Description |
---|
RealmBaseAdapter(OrderedRealmCollection<T> data) |
Modifier and Type | Method and Description |
---|---|
int | getCount() Returns how many items are in the data set. |
T | getItem(int position) Get the data item associated with the specified position in the data set. |
long | getItemId(int position) Get the row id associated with the specified position in the list. |
void | updateData(OrderedRealmCollection<T> data) Updates the data associated with the Adapter. |
areAllItemsEnabled, getAutofillOptions, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, setAutofillOptions, unregisterDataSetObserver
public RealmBaseAdapter(@Nullable OrderedRealmCollection<T> data)
public int getCount()
@Nullable public T getItem(int position)
position
- Position of the item whose data we want within the adapter's data set.public long getItemId(int position)
BaseAdapter.notifyDataSetChanged()
or updateData(OrderedRealmCollection)
has been called.position
- The position of the item within the adapter's data set whose row id we want.public void updateData(@Nullable OrderedRealmCollection<T> data)
notifyDataSetChanged()
to be called on the adapter. This method is therefore only useful if you want to display data based on a new query without replacing the adapter.data
- the new OrderedRealmCollection
to display.