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
.
Modifier and Type | Field and Description |
---|---|
protected android.content.Context |
context |
protected android.view.LayoutInflater |
inflater |
protected RealmResults<T> |
realmResults |
Constructor and Description |
---|
RealmBaseAdapter(android.content.Context context,
RealmResults<T> realmResults,
boolean automaticUpdate) |
Modifier and Type | Method and Description |
---|---|
int |
getCount() |
T |
getItem(int i) |
long |
getItemId(int i)
Returns the current ID for an item.
|
void |
updateRealmResults(RealmResults<T> queryResults)
Update the RealmResults associated to the Adapter.
|
areAllItemsEnabled, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
protected android.view.LayoutInflater inflater
protected RealmResults<T extends RealmObject> realmResults
protected android.content.Context context
public RealmBaseAdapter(android.content.Context context, RealmResults<T> realmResults, boolean automaticUpdate)
public int getCount()
public T getItem(int i)
public long getItemId(int i)
BaseAdapter.notifyDataSetChanged()
or
updateRealmResults(RealmResults)
has been called.i
- Index of item in the adapterpublic void updateRealmResults(RealmResults<T> queryResults)
queryResults
- the new RealmResults coming from the new query.