//试试这个请求android:minSdkVersion="7"
public void deleteAllCalendar(){
Log.i(TAG, "In deleteAllCalendar()");
String strUriEvents = "content://calendar/events";
Uri uri_calendar = Uri.parse(strUriEvents);
String str_column_name = "_id";
String[] projection = {str_column_name};
int columnIndex = 0;
String str_id = "";
Vector<String> vector_id = new Vector<String>();
int delRow = 0;
String where = "";
try {
Cursor cursor = cr.query(uri_calendar, projection, null, null, null);
if(cursor.moveToFirst()){
do{
columnIndex = cursor.getColumnIndex(str_column_name);
str_id = cursor.getString(columnIndex);
vector_id.add(str_id);
}while(cursor.moveToNext());
}
cursor.close();
for(int i=0; i<vector_id.size(); i++){
str_id = vector_id.get(i);
where = str_column_name+"="+str_id;
delRow = cr.delete(uri_calendar, where, null);
Log.i(TAG, "deleteAllCalendar(),delRow:"+delRow);
}
} catch (Exception e) {
// TODO Auto-generated catch block
Log.e(TAG, "deleteAllCalendar(),Exception");
e.printStackTrace();
}
Log.i(TAG, "Out deleteAllCalendar()");
}