编程语言
首页 > 编程语言> > 如何在Android中以编程方式获取All Sim Contacts?

如何在Android中以编程方式获取All Sim Contacts?

作者:互联网

如何以编程方式在Android中列出SIM卡联系人?我得到了代码来获得电话联系here但我也需要SIM卡联系人.

解决方法:

Uri simUri = Uri.parse("content://icc/adn");

  Cursor cursorSim = this.getContentResolver().query(simUri, null, null,null, null);

         while (cursorSim.moveToNext()) {           
             listName.add(cursorSim.getString(cursorSim.getColumnIndex("name")));
             listContactId.add(cursorSim.getString(cursorSim.getColumnIndex("_id")));      
             listMobileNo.add(cursorSim.getString(cursorSim.getColumnIndex("number")));
            }

simply now following code to get the simcard details..It works fine

标签:android,android-contacts
来源: https://codeday.me/bug/20190826/1725059.html