本文整理匯總了Java中android.support.v4.widget.SimpleCursorAdapter.FLAG_AUTO_REQUERY屬性的典型用法代碼示例。如果您正苦於以下問題:Java SimpleCursorAdapter.FLAG_AUTO_REQUERY屬性的具體用法?Java SimpleCursorAdapter.FLAG_AUTO_REQUERY怎麽用?Java SimpleCursorAdapter.FLAG_AUTO_REQUERY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.support.v4.widget.SimpleCursorAdapter
的用法示例。
在下文中一共展示了SimpleCursorAdapter.FLAG_AUTO_REQUERY屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateView
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
int[] fields = new int[]{R.id.item_id, R.id.item_name, R.id.item_room};
String[] headers = new String[]{"_id", "name", "room"};
View root = inflater.inflate(R.layout.fragment_contacts, container, false);
ListView lvContacts = (ListView) root.findViewById(R.id.lvcontacts);
lvContacts.setOnItemClickListener(this);
MainActivity activity = (MainActivity) getActivity();
//Cursor c = activity.mDb.rawQuery("SELECT * FROM person", null);
Cursor c = activity.mDb.rawQuery("SELECT id AS _id, name, 'кабинет №' || room as room FROM treatment", null);
SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(activity, R.layout.treatments_item2, c, headers, fields, SimpleCursorAdapter.FLAG_AUTO_REQUERY);
lvContacts.setAdapter(cursorAdapter);
return root;
}
示例2: onCreateView
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
int[] fields = new int[]{R.id.item_id, R.id.item_name, R.id.item_room};
String[] headers = new String[]{"_id", "nameroom", "begin"};
View root = inflater.inflate(R.layout.fragment_events, container, false);
ListView lvEvents = (ListView) root.findViewById(R.id.lvevents);
MainActivity activity = (MainActivity) getActivity();
Cursor c = activity.mDb.rawQuery("SELECT id AS _id, name||' в кабинете ' || room AS nameroom, datetime(start, 'unixepoch', 'localtime') AS begin FROM events;", null);
SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(activity, R.layout.events_item, c, headers, fields, SimpleCursorAdapter.FLAG_AUTO_REQUERY);
lvEvents.setAdapter(cursorAdapter);
return root;
}
示例3: onCreateView
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
int[] fields = new int[]{R.id.item_id, R.id.item_name, R.id.item_room};
String[] headers = new String[]{"_id", "fullname", "phone"};
View root = inflater.inflate(R.layout.fragment_contacts, container, false);
ListView lvContacts = (ListView) root.findViewById(R.id.lvcontacts);
MainActivity activity = (MainActivity) getActivity();
Cursor c = activity.mDb.rawQuery("SELECT id AS _id, fullname, phone FROM person", null);
SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(activity, R.layout.contacts_item, c, headers, fields, SimpleCursorAdapter.FLAG_AUTO_REQUERY);
lvContacts.setAdapter(cursorAdapter);
lvContacts.setOnItemClickListener(this);
return root;
}