Wednesday, October 19, 2011

android.content.OperationApplicationException: wrong number of rows: 0

Today I got this error tying to update a contact in Android 2.3 Nexus S device which was working fine on Motorola Milestone (Android 2.1 - update 1). Reason was I was getting the "withExpectedCount" parameter as 1

ops.add(ContentProviderOperation. newInsert(addCallerIsSyncAdapterParameter(ContactsContract.Data.CONTENT_URI))
.withValue(ContactsContract.Data.RAW_CONTACT_ID, contact.getId())
.withValue(ContactsContract.Data.MIMETYPE, CommonDataKinds.Phone.CONTENT_ITEM_TYPE)
.withValue(CommonDataKinds.Phone.NUMBER, phone)
.withValue(CommonDataKinds.Phone.TYPE, cm.getType()).withExpectedCount(1).build());

When i removed it it worked fine .. Looks like if the original and updating content values are same it does not update the row :|

No comments:

Post a Comment