Android How to read android Contacts and SIM Contacts?
20:17 26 Nov 2012

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.

android android-contacts contactscontract sim-card