Hi, We are writing the application about accessing the contacts on SIM, including add, query, and delete. The operation "add" works well, while the query operation will return all records on SIM although I have added the selection condition, such as "name=xxx", and the delete operation doesn't work at all. The code is list as following, could any one give me the suggestion on it?
Any reply will be appreciated. Thanks & Regards, Stanley // create a contact on SIM ContentValues values = new Uri simUri = Uri.parse("content://icc/adn"); ContentValues values = new ContentValues(); values.put("tag", contact); values.put("number", phoneNumber); ContentResolver resolver = getContentResolver(); Uri row = resolver.insert(simUri, values); if (row == null) { return false; } values.clear(); // Find this contact on SIM Cursor cur = managedQuery(simUri, new String[] { "name", "number" }, "number='" + phoneNumber + "'", null, null); // if (!cur.moveToFirst()) { return false; } else { while (true) { if (!cur.moveToNext()) break; } } // cleanup,delete it in SIM // int num = getContentResolver().delete(simUri, "name=?", // new String[] { contact }); int num = getContentResolver().delete(simUri, "number=" + phoneNumber, null); if (num == 0) { return false; } return true; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---