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

成都創(chuàng)新互聯(lián)專注于企業(yè)網(wǎng)絡(luò)營(yíng)銷推廣、網(wǎng)站重做改版、恭城網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5技術(shù)、電子商務(wù)商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為恭城等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
以下為主要代碼:
- 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顯示電話的姓名、號(hào)碼兩個(gè)欄位
- ListAdapter adapter = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_2, cursor, string,intText);
- setListAdapter(adapter);
- }
- }
新聞標(biāo)題:AndroidSDK1.6之下讀取手機(jī)聯(lián)系人
文章出自:http://www.5511xx.com/article/cdecjid.html


咨詢
建站咨詢
