Hello, I am looking the answer to the same question.I am trying to save a contact into the sim card and retrive a list of contacts. And i got the following error: " Cannot load ADN records", Anyone how knows the answer or any suggestion please help me.
Regars, Lidy On Jul 12, 8:02 pm, Fabrizio Gennari <[email protected]> wrote: > Hello. > > I am trying to read and write contacts on the SIM phonebook. > > First I tried writing a contact with GetContentResolver.insert(), > passing RawContacts.CONTENT_URI as URI and ensuring the column > RawContacts.ACCOUNT_NAME had the value "SIM", and adding 2 lines (1 for4 > name and 1 for phone) to Data.CONTENT_URI, linked by contact ID. This > seemed to work: the contacts showed in the contact list with the SIM > logo next to them, but they wouldn't survive a reboot... apparently > that's just a placeholder in memory, which is synced with the real SIM > at startup and at every change. > > Then I tried reading the list of contacs on the SIM with > > Cursor cur = getContentResolver().query( > Uri.parse("content://icc/adn") > ,null > ,null > ,null > ,null > ); > > This fails with a NullPointerException on a real phone. On the emulator, it > returns a Cursor with 0 lines. This sounds likely. > Strangely, accessing content://icc/fdn and content://icc/sdn both work, both > on emulator and on phone. > > Finally, I tried writing a contact with > > ContentValues values = new ContentValues(); > values.put("name","Name Of Contact"); > values.put("number", "+777777777"); > Uri uri = getContentResolver().insert( > Uri.parse("content://icc/adn") > , values) > ; > > This returns a null URI and no contact is inserted. > > What's wrong there, and what's the right way of doing this? > > Regards, > Fabrizio -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

