public abstract class ItemsAdapter<T,VH extends ItemsAdapter.ViewHolder>
extends android.widget.BaseAdapter
BaseAdapter
implementation to use List
as a source.getView
method is divided into
onCreateHolder(ViewGroup, int)
and onBindHolder(ViewHolder, int)
methods.Modifier and Type | Class and Description |
---|---|
protected static class |
ItemsAdapter.ViewHolder |
Constructor and Description |
---|
ItemsAdapter() |
Modifier and Type | Method and Description |
---|---|
int |
getCount() |
T |
getItem(int position) |
long |
getItemId(int pos) |
java.util.List<T> |
getItemsList() |
android.view.View |
getView(int pos,
android.view.View convertView,
android.view.ViewGroup parent) |
protected abstract void |
onBindHolder(VH viewHolder,
int position) |
protected abstract VH |
onCreateHolder(android.view.ViewGroup parent,
int viewType) |
void |
setItemsList(java.util.List<T> list)
Sets list to this adapter and calls
BaseAdapter.notifyDataSetChanged() to update underlying
ListView .You can pass null to clear the adapter. |
public void setItemsList(java.util.List<T> list)
BaseAdapter.notifyDataSetChanged()
to update underlying
ListView
.null
to clear the adapter.public java.util.List<T> getItemsList()
public int getCount()
public T getItem(int position)
public long getItemId(int pos)
public final android.view.View getView(int pos, android.view.View convertView, android.view.ViewGroup parent)
protected abstract VH onCreateHolder(android.view.ViewGroup parent, int viewType)
protected abstract void onBindHolder(VH viewHolder, int position)