新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
AndroidSDK1.6之下讀取手機聯(lián)系人
Android在2.0之上的版本對聯(lián)系人等相關API作了大幅調整,因此在1.6版本上的操作移植到2.0并不推薦。這里簡單寫一下在SDK1.6版本下的操作方式。
最重要的千萬別忘了在AndroidManifest.xml添加讀取聯(lián)系人的權限

成都創(chuàng)新互聯(lián)專注于企業(yè)網(wǎng)絡營銷推廣、網(wǎng)站重做改版、恭城網(wǎng)站定制設計、自適應品牌網(wǎng)站建設、H5技術、電子商務商城網(wǎng)站建設、集團公司官網(wǎng)建設、成都外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應式網(wǎng)頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為恭城等各大城市提供網(wǎng)站開發(fā)制作服務。
以下為主要代碼:
- public class Activity01 extends ListActivity
- {
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- //Cursor獲取電話URI
- Cursor cursor = getContentResolver().query(Phones.CONTENT_URI, null, null,null,
- null);
- startManagingCursor(cursor);
- String[] string={ Phones.NAME, Phones.NUMBER };
- int[] intText={ android.R.id.text1, android.R.id.text2 };
- // 使用 simple_list_item_2顯示電話的姓名、號碼兩個欄位
- ListAdapter adapter = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_2, cursor, string,intText);
- setListAdapter(adapter);
- }
- }
當前標題:AndroidSDK1.6之下讀取手機聯(lián)系人
URL標題:http://fisionsoft.com.cn/article/cdecjid.html


咨詢
建站咨詢
