Android 安卓日历

Android 安卓日历,android,calendar,Android,Calendar,LogCat返回以下错误: 错误/AndroidRuntime(601):原因:android.content.ActivityNotFoundException: 找不到显式活动类{com.android.calendar/com.android.calendar.LaunchActivity} 您是否在AndroidManifest.xml中声明了此活动 新的日历地址或软件包是什么?这只适用于普通android手机。在制造商实施了自己日历的手机上,日历类的类名将不同。试试这个 它为我工作,打

LogCat返回以下错误:

错误/AndroidRuntime(601):原因:android.content.ActivityNotFoundException:
找不到显式活动类
{com.android.calendar/com.android.calendar.LaunchActivity}

您是否在AndroidManifest.xml中声明了此活动


新的日历地址或软件包是什么?

这只适用于普通android手机。在制造商实施了自己日历的手机上,日历类的类名将不同。

试试这个

它为我工作,打开谷歌日历,而不是手机

ComponentName componentName = new ComponentName("com.android.calendar",
        "com.android.calendar.LaunchActivity");
if (componentName != null) {
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
    // com.android.providers.calendar.CalendarProvider
    intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);

    intent.setComponent(componentName);
    startActivity(intent);
} else {
    Log.i("", "98979");
}

我也在搜索打开手机日历

试试这个打开手机日历

 Intent i = new Intent();

//Froyo or greater (mind you I just tested this on CM7 and the less than froyo one worked so it    depends on the phone...)
cn = new ComponentName("com.google.android.calendar", "com.android.calendar.LaunchActivity");

 //less than Froyo
 cn = new ComponentName("com.android.calendar", "com.android.calendar.LaunchActivity");

i.setComponent(cn);
startActivity(i);
intsdk=android.os.Build.VERSION.sdk\u int;
int ICE\u CREAM\u BUILD\u ID=android.os.BUILD.VERSION\u CODES.ICE\u CREAM\u三明治;
如果(sdk<冰淇淋\u构建\u ID){
//所有的冰淇淋三明治
意向意向=新意向(意向.行动\编辑);
intent.setType(“vnd.android.cursor.item/event”);
intent.putExtra(“开始时间”,开始时间);
intent.putExtra(“结束时间”,结束时间);
意向。额外(“标题”,标题);
意图。额外(“说明”,说明);
intent.putExtra(“事件位置”,位置);
intent.putExtra(“全天”,即全天);
星触觉(意向);
}否则{
//冰淇淋三明治及以上
意向意向=新意向(意向.行动\编辑);
intent.setType(“vnd.android.cursor.item/event”);
intent.putExtra(CalendarContract.EXTRA\u EVENT\u BEGIN\u TIME,startTime);
intent.putExtra(CalendarContract.EXTRA\u EVENT\u END\u TIME,endTime);
意向。额外(事件。标题,标题);
intent.putExtra(Events.ACCESS\u LEVEL,Events.ACCESS\u PRIVATE);
intent.putExtra(CalendarContract.EXTRA\u EVENT\u ALL\u DAY,isAllDay);
intent.putExtra(Events.DESCRIPTION,DESCRIPTION);
intent.putExtra(Events.EVENT_位置,位置);
星触觉(意向);
}

Hi,您能编辑您的问题并正确格式化代码段吗?下面是堆栈溢出语法参考:请也帮助这个线程
int sdk = android.os.Build.VERSION.SDK_INT;
int ICE_CREAM_BUILD_ID = android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
if(sdk < ICE_CREAM_BUILD_ID) {
    // all SDK below ice cream sandwich
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("beginTime", startTime);
    intent.putExtra("endTime", endTime);
    intent.putExtra("title", title);
    intent.putExtra("description", description);
    intent.putExtra("eventLocation", location);
    intent.putExtra("allDay", isAllDay);
    startActivity(intent);
} else {
    // ice cream sandwich and above
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, startTime);
    intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime);
    intent.putExtra(Events.TITLE, title);
    intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE);
    intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY , isAllDay);
    intent.putExtra(Events.DESCRIPTION, description);
    intent.putExtra(Events.EVENT_LOCATION, location);

    startActivity(intent);
}