I got a ContentProvider that serves some content e.g. filters. Those will be rendered in a ListView. Because the filter has many fields I needed to create an own View for the list items. The fields are mapped in a class that extends CursorAdapter.
public void bindView(View view, Context context, Cursor cursor) {
TextView searchPattern = (TextView) view.findViewById(R.id.tv_searchpattern);
TextView searchType = (TextView) view.findViewById(R.id.tv_searchtype);
int type = cursor.getInt(FilterProvider.SEARCH_TYPE_COLUMN);
[...]
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
final View view = inflater.inflate(R.layout.group_list_item, parent, false);
return view;
}
But now I am wondering how I could "carry" the content uris along with the list items. So that I later can retrieve them later easily to operate (e.g. update, delete) on the item?
利用观点是否是一个好的想法?
view.setId(cursor.getInt(FilterProvider.KEY_COLUMN));
还是我完全走上错误的道路? 难道我需要担心的是,在Sqlite,Integer实际上是很长的?