4

I've got a problem with removing contacts I previously created on SIM card.

First of all I'm checking what values are stored in DB like this:

private static final Uri URI_ICC_ADN = Uri.parse("content://icc/adn/");
private ContentResolver mContentResolver = this.getContentResolver();

Cursor c = mContentResolver.query(URI_ICC_ADN, null, null, null, null);
c.moveToFirst();
while(c.moveToNext()) {
     Log.i(LOG_TAG, "name = " + c.getString(c.getColumnIndex("name")));
}

And this provides me with those logs:

name = 1
name = 2
name = 3
name = 1
name = 2
name = 5
// etc

It means that records with name = 1 exist in DB. Now I'm trying to delete those records with this code:

int rowsDeleted = mContentResolver.delete(URI_ICC_ADN, "name=?", new String[] { "1" });

But unfortunately those rows are not removed - rowsDeleted equals 0. I've also tried this:

int rowsDeleted = mContentResolver.delete(URI_ICC_ADN, "name=1", null);

But the result is the same. What am I doing wrong?

Piotr Chojnacki
  • 6,837
  • 5
  • 34
  • 65

1 Answers1

1

"name" is only for read query. For deletion you have to pass "tag" for the name column. Check this link for the actual implementation IccProvider

Ankur Kumar
  • 972
  • 7
  • 12