- Apr 25, 2018
- 1
- 0
- 0
I need help with this code that I've been trying to figure out for hours. I know it's something close to what I have from my research, but I can't get it to work. Not even the codes provided from other posts works for me on here. Any ideas?
public void checkEventsInCal() {
ContentResolver cr = getContentResolver();
Cursor cursor = cr.query(Uri.parse("content://com.android.calendar/events"), new String[]{"_id"}, "_id=?", new String[]{CalendarContract.Events.TITLE}, null);
if (cursor.moveToFirst()) {
Toast.makeText(this,"Event Exists!", Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(this,"Event Doesn't Exist!", Toast.LENGTH_SHORT).show();
}
}
public void checkEventsInCal() {
ContentResolver cr = getContentResolver();
Cursor cursor = cr.query(Uri.parse("content://com.android.calendar/events"), new String[]{"_id"}, "_id=?", new String[]{CalendarContract.Events.TITLE}, null);
if (cursor.moveToFirst()) {
Toast.makeText(this,"Event Exists!", Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(this,"Event Doesn't Exist!", Toast.LENGTH_SHORT).show();
}
}