Hi all,
I'm trying to remove all group memberships of a person, and my code is
as follows:
private static final String[] GROUP_MEMBERSHIP_PROJECTION = new
String[] {
GroupMembership.GROUP_ID, // 0
GroupMembership.PERSON_ID // 1
};
long personId = ContentUris.parseId(mUri);
//Wysie_Soh: Remove all group memberships (not working)
Cursor c = getContentResolver().query
(GroupMembership.CONTENT_URI,
GROUP_MEMBERSHIP_PROJECTION,
GroupMembership.PERSON_ID + "='" + personId + "'",
null, null);
if (c.moveToFirst()) {
while (c.moveToNext()) {
int i = mResolver.delete(ContentUris.withAppendedId(
GroupMembership.CONTENT_URI, c.getLong(0)),
GroupMembership.PERSON_ID + "='" + personId +
"'",
null);
Log.d("ROWS DEL", "" + i);
}
c.close();
}
However, ROWS DEL always returns 0. Please help, thank you :)!
--
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