public abstract class RealmBaseAdapter<T extends RealmObject>
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,
RealmResults<T> realmResults,
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 |
updateRealmResults(RealmResults<T> queryResults)
Updates the RealmResults associated to the Adapter.
|
areAllItemsEnabled, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
public RealmBaseAdapter(android.content.Context context, RealmResults<T> realmResults, 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.public void updateRealmResults(RealmResults<T> queryResults)
queryResults
- the new RealmResults coming from the new query.