Deleting a calendar on Android using ContentResolver
So I messed up while playing with the content://com.android.calendar/calendars database on my phone. I managed to insert a new calendar with null as a displayName; and now my Calendar app is crashing on open saying "The display name can't be null".
So now I'm trying to delete that calendar but I'm stuck... Here is what I'm trying:开发者_JAVA百科
Here is the list of calendars in the DB
INFO/System.out(4170): Id: 1 Display Name: myemail@gmail.com Selected: true INFO/System.out(4170): Id: 3 Display Name: null Selected: true
And then I want to delete the second one so:
Uri cal = Uri.parse("content://com.android.calendar/calendars");
getContentResolver().delete(cal, "_id=?", new String[] {"3"});
Without success.... any ideas? It doesn't crash, but the query returns 0, meaning no rows have been deleted. Thanks in advance
精彩评论