public class ViewModelAdapter<T>
extends android.widget.BaseAdapter
ViewModel<T>
.Constructor and Description |
---|
ViewModelAdapter(android.content.Context context,
int layoutId,
List<T> items)
Constructs a new ViewModelAdapter with the given layout and items.
|
Modifier and Type | Method and Description |
---|---|
protected android.content.Context |
getContext() |
int |
getCount() |
T |
getItem(int i) |
long |
getItemId(int i) |
List<T> |
getItems()
Returns the backing list.
|
android.view.View |
getView(int i,
android.view.View convertView,
android.view.ViewGroup parent) |
void |
replace(List<T> items) |
public ViewModelAdapter(android.content.Context context, int layoutId, List<T> items)
ViewModel<T>
as is expected to hold the logic of updating its children.
Note that this class does not make a copy of the list you pass in. You can modify the
original list and call notifyDataSetChanged()
to update the view.context
- the contextlayoutId
- the layout to inflateitems
- the list of items to showpublic int getCount()
public T getItem(int i)
public long getItemId(int i)
public android.view.View getView(int i, android.view.View convertView, android.view.ViewGroup parent)
public List<T> getItems()
protected android.content.Context getContext()
Copyright © 2011–2014. All rights reserved.