저는 콘텐츠를 제공하는 ContentProvider를 가지고 있습니다. 필터. ListView에서 렌더링됩니다. 필터에는 많은 필드가 있기 때문에 목록 항목에 대한 자체 뷰를 만드는 데 필요했습니다. 필드는 CursorAdapter를 확장하는 클래스에 매핑됩니다.CursorAdapter에 URI/id 저장하기
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;
}
하지만 지금은 어떻게 목록 항목과 함께 콘텐츠 uri를 "옮길 수 있는지"궁금합니다. 나중에 항목을 나중에 쉽게 검색 (예 : 업데이트, 삭제) 할 수 있습니까?
View.id 필드를 사용하는 것이 좋습니다.
view.setId(cursor.getInt(FilterProvider.KEY_COLUMN));
아니면 완전히 잘못된 트랙에 있습니까? Integer가 실제로 Sqlite에서 Long이기 때문에 걱정할 필요가 있습니까?