Android: how to access the SIM contact table using the SDK?

后端 未结 3 1739
梦谈多话
梦谈多话 2020-12-18 06:04

I am trying to use this query to read the contacts on the SIM.

            cur = managedQuery(Uri.parse(\"content://icc/adn\")
                ,null
                 


        
3条回答
  •  一个人的身影
    2020-12-18 06:48

    i have used the following code to get the simcard details..It works fine

    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")));
                }
    

    Here the name, _id, number are column names from the simcard table

提交回复
热议问题