错误插入事件到日历意图 [英] Error Inserting Event into Calendar with Intent

查看:100
本文介绍了错误插入事件到日历意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图插入事件从一个片段的日历,但我不断收到任何活动都不会被发现处理意图的错误。

下面是错误 - android.content.ActivityNotFoundException:无活动处理意向{行为= android.intent.action.INSERT猫= [android.intent.category.APP_CALENDAR]典型值= vnd.android.cursor.item /事件(有临时演员)}

下面是我的code:

 意向意图=新的意图(Intent.ACTION_INSERT);
intent.addCategory(Intent.CATEGORY_APP_CALENDAR);
intent.setType(vnd.android.cursor.item /事件);
intent.putExtra(Events.TITLE,光疗治疗);
intent.putExtra(Events.EVENT_LOCATION,);
intent.putExtra(Events.DESCRIPTION,光疗治疗);

//设置日期
日历calDate = Calendar.getInstance();
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
    calDate.getTimeInMillis());
intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
calDate.getTimeInMillis()+ 60 * 60 * 1000);

//使它成为一个整天事件
intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY,假);

//使它成为一个经常性事件
intent.putExtra(Events.RRULE,频率=每周; COUNT =+ Integer.valueOf(No.getText()的toString())+;
+WKST = SU; BYDAY =+天);

//使其成为私人和显示为忙
 intent.putExtra(Events.ACCESS_LEVEL,Events.ACCESS_PRIVATE);
 intent.putExtra(Events.AVAILABILITY,Events.AVAILABILITY_BUSY);

startActivity(意向);
 

意图过滤器

 <意向滤光器>
<作用机器人:名称=android.intent.action.MAIN/>
<作用机器人:名称=android.intent.action.INSERT/>
<类机器人:名称=android.intent.category.APP_CALENDAR/>
<数据机器人:MIMETYPE =vnd.android.cursor.item /事件/>
&所述; /意图滤光器>
 

解决方案

我用意向意图=新的意图(Intent.ACTION_EDIT);它似乎来解决问题。

I'm trying to insert events to the calendar from a fragment, but I keep getting an error that no activity is found to handle Intent.

Here's the error - android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.INSERT cat=[android.intent.category.APP_CALENDAR] typ=vnd.android.cursor.item/event (has extras) }

Here's my code:

Intent intent = new Intent(Intent.ACTION_INSERT);
intent.addCategory(Intent.CATEGORY_APP_CALENDAR);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra(Events.TITLE, "Phototherapy Treatment");
intent.putExtra(Events.EVENT_LOCATION, "");
intent.putExtra(Events.DESCRIPTION, "Phototherapy Treatment");

// Setting dates
Calendar calDate = Calendar.getInstance();
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
    calDate.getTimeInMillis());
intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
calDate.getTimeInMillis()+60*60*1000);

// Make it a full day event
intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, false);

// Make it a recurring Event                    
intent.putExtra(Events.RRULE, "FREQ=WEEKLY;COUNT="+Integer.valueOf(No.getText().toString())+";"
+"WKST=SU;BYDAY="+days);

// Making it private and shown as busy
 intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE);
 intent.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY);

startActivity(intent);

Intent Filter

<intent-filter> 
<action android:name="android.intent.action.MAIN" /> 
<action android:name="android.intent.action.INSERT" /> 
<category android:name="android.intent.category.APP_CALENDAR" /> 
<data android:mimeType="vnd.android.cursor.item/event" /> 
</intent-filter>

解决方案

I used Intent intent = new Intent(Intent.ACTION_EDIT); and it seemed to resolve the issue

这篇关于错误插入事件到日历意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆