當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleCursorAdapter.FLAG_AUTO_REQUERY屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:Harrix,項目名稱:uchimznaem-helper,代碼行數:15,代碼來源:TreatmentsFragment.java

示例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;
}
 
開發者ID:Harrix,項目名稱:uchimznaem-helper,代碼行數:13,代碼來源:EventsFragment.java

示例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;
}
 
開發者ID:Harrix,項目名稱:uchimznaem-helper,代碼行數:14,代碼來源:ContactsFragment.java


注:本文中的android.support.v4.widget.SimpleCursorAdapter.FLAG_AUTO_REQUERY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。