Here is my custom CursorAdapter:
public class TasksAdapter extends CursorAdapter implements Filterable {
private final Context context;
public Task
My implementation of a class extends SimpleCursorAdapter with newView and bindView but without the ViewHolder pattern
private class CountriesAdapter extends SimpleCursorAdapter {
private LayoutInflater mInflater;
public CountriesAdapter(Context context, int layout, Cursor cursor, String[] from,
int[] to, LayoutInflater inflater) {
super(getActivity(), layout, cursor, from, to, CURSOR_ADAPTER_FLAGS);
mInflater = inflater;
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return mInflater.inflate(R.layout.countries_list_row, parent, false);
}
@Override
public void bindView(View rowView, Context context, Cursor cursor) {
TextView tvCountry = (TextView) rowView.findViewById(R.id.countriesList_tv_countryName);
TextView tvOrgs = (TextView) rowView.findViewById(R.id.countriesList_tv_orgNames);
ImageView ivContinent =
(ImageView) rowView.findViewById(R.id.countriesList_iv_continentName);
// TODO: set texts of TextViews and an icon here
}
}
}