1

I am getting this error in HTC(v2.3.3) and works in Galaxy s3(v4.1)

Intent intent = new Intent(Intent.ACTION_EDIT)
            .setData(Uri.parse(EventUtils.EVENT_URI))
            .putExtra(Event.EXTRA_EVENT_BEGIN_TIME,
                    beginTime.getTimeInMillis())
            .putExtra(Event.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis())
            .putExtra(
                    Event.TITLE,
                    Utils.getPref(getApplicationContext(),
                            Constant.PREF_EVENT_TAG,
                            Constant.CONST_EVENT_TAG)
                            + "Meeting")
            .putExtra(Event.DESCRIPTION, "important meeting")
            .putExtra(Event.AVAILABILITY, Events.AVAILABILITY_BUSY);
    // .putExtra(Event.EVENT_LOCATION, "The gym")
    // .putExtra(Intent.EXTRA_EMAIL,
    // "rowan@example.com,trevor@example.com");

    if (calID != -1) {
        intent.putExtra(Event.CALENDAR_ID, calID);
    }

    startActivity(intent);

Exception

01-13 18:58:59.417: E/AndroidRuntime(31730): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.EDIT dat=content://com.android.calendar/events (has extras) }

How can it be resolved?

Bhavesh Hirpara
  • 22,255
  • 15
  • 63
  • 104

2 Answers2

1

What Android Version do you have on HTC? -- I think the Calendar Indent is only around since Android 4.

Edit:

What you use and what also How to set a reminder in Android? uses, is sort of a non-offical way to add calendar events, and this will work or not work depending on the various Android implementations and devices.

Starting with Android 4 (API Level 14) there is an official way to do it, using the CalendarProvider.

Community
  • 1
  • 1
Ridcully
  • 23,362
  • 7
  • 71
  • 86
0

Most Probably you have set wrong data for your intent... Check your Uri parameter in Intent.setData() method....

Also you should surround that with try/catch, because some users that have calendar app disabled/uninstalled may get a force close when launching that intent

BamsBamx
  • 4,139
  • 4
  • 38
  • 63