问题
I am currently getting read only android contacts, below is the code I'm using:
String[] projecao = new String[] { Contacts._ID,
Contacts.LOOKUP_KEY, Contacts.DISPLAY_NAME };
String selecao = Contacts.HAS_PHONE_NUMBER + " = 1";
Cursor contatos = contexto.getContentResolver().query(
ContactsContract.Contacts.CONTENT_URI, projecao, selecao, null, null);
And to get Phone Number:
Cursor phones = contexto.getContentResolver().query(
Phone.CONTENT_URI,
new String[] { Phone.NUMBER },
Phone.CONTACT_ID + " = ?",
new String[] { contatos.getString(contatos
.getColumnIndex(Contacts._ID)) }, null);
I want to maintain a database of all contacts with numbers.
What I'm to do for get SIM card Contacts too?
Thank you for your time.
回答1:
To get phone contacts you can visit this link
and for sim contacts click here
回答2:
The Contacts you're reading are from the Contacts Provider, which is part of the Android platform. They're not read-only, although you should read the documentation before attempting to change them.
SIM card contacts are completely different. They're stored separately on the SIM card itself, and you probably have to use an app from the handset manufacturer or service provider to get to them. They have nothing to do with Google Contacts. I recommend against doing anything with them.
来源:https://stackoverflow.com/questions/13575286/android-how-to-read-android-contacts-and-sim-contacts