Shahar Yaari
Lurker
encountered a problem that I just can't figure out.
I'm trying to add an event to the android calendar. this is for sdk 2.3.3. I've tried different things and nothing seems to work. The following code is suppose to get the devices' calendars, according to the sdk (before/after 2.2), but the cursor is null in both cases.
Because of this, when I'm trying to use cursor.moveToFirst(), I get the error: failed to find provider info for calendar/com.android.calendar.
I really don't know what am I doing wrong..
String calendarUriBase = null;
calendarUri = Uri.parse("content://calendar/calendars");
Cursor managedCursor = null;
try
{
managedCursor = managedQuery(calendarUri, null, null, null, null);
}
catch (Exception e)
{
// eat
}
if (managedCursor != null)
calendarUriBase = "content://calendar/";
else
{
calendarUri = Uri.parse("content://com.android.calendar/calendars");
try
{
managedCursor = managedQuery(calendarUri, null, null, null, null);
}
catch (Exception e)
{
// statement to print the stacktrace
}
if (managedCursor != null)
calendarUriBase = "content://com.android.calendar/";
}
The same occurs when, instead of managedQuery(), I use:
getContentResolver().query(calendarUri, new String[]{
"calendar_id", "displayname"}, null, null, null);
I'm trying to add an event to the android calendar. this is for sdk 2.3.3. I've tried different things and nothing seems to work. The following code is suppose to get the devices' calendars, according to the sdk (before/after 2.2), but the cursor is null in both cases.
Because of this, when I'm trying to use cursor.moveToFirst(), I get the error: failed to find provider info for calendar/com.android.calendar.
I really don't know what am I doing wrong..
String calendarUriBase = null;
calendarUri = Uri.parse("content://calendar/calendars");
Cursor managedCursor = null;
try
{
managedCursor = managedQuery(calendarUri, null, null, null, null);
}
catch (Exception e)
{
// eat
}
if (managedCursor != null)
calendarUriBase = "content://calendar/";
else
{
calendarUri = Uri.parse("content://com.android.calendar/calendars");
try
{
managedCursor = managedQuery(calendarUri, null, null, null, null);
}
catch (Exception e)
{
// statement to print the stacktrace
}
if (managedCursor != null)
calendarUriBase = "content://com.android.calendar/";
}
The same occurs when, instead of managedQuery(), I use:
getContentResolver().query(calendarUri, new String[]{
"calendar_id", "displayname"}, null, null, null);