zoukankan      html  css  js  c++  java
  • Cursor getContentResolver

    /**
     * This interface provides random read-write access to the result set returned
     * by a database query.
     */
    public class cp extends ListActivity {
        
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
     /**
         * This method allows the activity to take care of managing the given
         * {@link Cursor}'s lifecycle for you based on the activity's lifecycle.
         * That is, when the activity is stopped it will automatically call
         * {@link Cursor#deactivate} on the given Cursor, and when it is later restarted
         * it will call {@link Cursor#requery} for you.  When the activity is
         * destroyed, all managed Cursors will be closed automatically.
         * 
         * @param c The Cursor to be managed.
         * 
         * @see #managedQuery(android.net.Uri , String[], String, String[], String)
         * @see #stopManagingCursor
         */
    
            Cursor c = getContentResolver().query(Phones.CONTENT_URI, null, null, null, null);
            startManagingCursor(c); 
            ListAdapter adapter = new SimpleCursorAdapter(this,
                    android.R.layout.simple_list_item_2, c, 
                            new String[] { Phones.NAME, Phones.NUMBER }, 
                            new int[] { android.R.id.text1, android.R.id.text2 });
            setListAdapter(adapter);
        }    
    }	


  • 相关阅读:
    C#操作json
    sql server 2008 身份验证失败 18456
    MD5密码加密
    oracle dg 报错提示 涉及硬盘错误
    Rhel6.5 相关操作
    Centos6.9部署vnc
    Sqluldr2 libclntsh.so报错处理
    时钟服务器同步方法
    windows copy 和xcopy
    Linux 本地repo配置
  • 原文地址:https://www.cnblogs.com/flyingsir/p/3983749.html
Copyright © 2011-2022 走看看