com.yy.androidlib.util.sdk.BaseAdapter Maven / Gradle / Ivy
package com.yy.androidlib.util.sdk;
import java.util.ArrayList;
import java.util.List;
public abstract class BaseAdapter extends android.widget.BaseAdapter {
protected List items = new ArrayList();
@Override
public int getCount() {
if (items == null) {
return 0;
} else {
return items.size();
}
}
@Override
public T getItem(int i) {
if (i < 0 || i >= items.size()) {
return null;
} else {
return items.get(i);
}
}
@Override
public long getItemId(int i) {
return i;
}
public void setItems(List data) {
this.items = new ArrayList(data);
notifyDataSetChanged();
}
public List getItems() {
return items;
}
}