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 read objects, will at this point also result in a
RealmException
.
Constructor and Description |
---|
RealmBaseAdapter(android.content.Context context,
OrderedRealmCollection<T> data,
boolean automaticUpdate) |
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Returns how many items are in the data set.
|
T |
getItem(int i)
Returns the item associated with the specified position.
|
long |
getItemId(int i)
Returns the current ID for an item.
|
void |
updateData(OrderedRealmCollection<T> data)
Updates the data associated with the Adapter.
|
void |
updateRealmResults(RealmResults<T> queryResults)
Deprecated.
|
areAllItemsEnabled, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
public RealmBaseAdapter(android.content.Context context, OrderedRealmCollection<T> data, boolean automaticUpdate)
public int getCount()
public T getItem(int i)
i
- index of item whose data we want.public long getItemId(int i)
BaseAdapter.notifyDataSetChanged()
or updateRealmResults(RealmResults)
has been called.i
- index of item in the adapter.@Deprecated public void updateRealmResults(RealmResults<T> queryResults)
updateData(OrderedRealmCollection)
instead.public void updateData(OrderedRealmCollection<T> data)
notifyDataSetChanged()
to be called on the adapter.
This method is therefor only useful if you want to display data based on a new query without replacing the
adapter.data
- the new OrderedRealmCollection
to display.