[英]ContactsContract.Data.CONTENT_URI getting deleted contacts
[英]SIM card contacts in ContactsContract.Data.CONTENT_URI
我可以使用ContactsContract.Data.CONTENT_URI
從哪些來源獲取數據。 特別是,如果包含SIM卡聯系人,我很感興趣。
謝謝
如果您想要Sim Card的所有聯系人,請嘗試以下代碼:
private void SIMContacts()
{
try
{
String strPhonename = null;
String strphoneNo = null;
Uri simUri = Uri.parse("content://icc/adn");
Cursor cursorSim = this.getContentResolver().query(simUri,null,null,null,null);
while (cursorSim.moveToNext())
{
strPhonename =cursorSim.getString(cursorSim.getColumnIndex("name"));
strphoneNo = cursorSim.getString(cursorSim.getColumnIndex("number"));
strphoneNo.replaceAll("\\D","");
strphoneNo.replaceAll("&", "");
strPhonename=strPhonename.replace("|","");
Log.i("Contact: ", "name: "+strPhonename+" phone: "+strphoneNo);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.