カレンダーにイベントを挿入しようとしていますが、Android4以降とAndroid2.2で完全に機能しますが、Android 2.3でアプリを実行すると、次のように強制的に閉じます。
処理するアクティビティが見つかりません
Intent { act=android.intent.action.INSERT dat=content://com.android.calendar/events (has extras) }
ここにコードを示します:
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
Uri u;
if (currentapiVersion > android.os.Build.VERSION_CODES.FROYO){
u = Uri.parse("content://com.android.calendar/events");
} else{
u = Uri.parse("content://calendar/events");
}
Intent intent = new Intent(Intent.ACTION_INSERT)
.setData(u)
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, begin.getTimeInMillis())
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end.getTimeInMillis())
.putExtra(Events.TITLE, title)
.putExtra(Events.DESCRIPTION, description)
.putExtra(Events.EVENT_LOCATION, getString(R.string.lugar)+ ": "+lugar)
.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY);
String dest = new String();
for(int k=0;k<destinatarios.length;k++){
if(dest.equals("")){
dest = destinatarios[k];
}else{
dest += ","+destinatarios[k];
}
}
intent.putExtra(Intent.EXTRA_EMAIL, dest);
startActivity(intent);
logcatを表示します:
11-28 12:13:06.113: E/AndroidRuntime(350): FATAL EXCEPTION: main
11-28 12:13:06.113: E/AndroidRuntime(350): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.INSERT dat=content://com.android.calendar/events (has extras) }
11-28 12:13:06.113: E/AndroidRuntime(350): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.app.Activity.startActivityForResult(Activity.java:2827)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.app.Activity.startActivity(Activity.java:2933)
11-28 12:13:06.113: E/AndroidRuntime(350): at com.moya.gestor.futbol.EventList.onContextItemSelected(EventList.java:283)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.app.Activity.onMenuItemSelected(Activity.java:2209)
11-28 12:13:06.113: E/AndroidRuntime(350): at com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback.onMenuItemSelected(PhoneWindow.java:2785)
11-28 12:13:06.113: E/AndroidRuntime(350): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
11-28 12:13:06.113: E/AndroidRuntime(350): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
11-28 12:13:06.113: E/AndroidRuntime(350): at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:137)
11-28 12:13:06.113: E/AndroidRuntime(350): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:873)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.widget.ListView.performItemClick(ListView.java:3513)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.os.Handler.handleCallback(Handler.java:587)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.os.Handler.dispatchMessage(Handler.java:92)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.os.Looper.loop(Looper.java:123)
11-28 12:13:06.113: E/AndroidRuntime(350): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-28 12:13:06.113: E/AndroidRuntime(350): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 12:13:06.113: E/AndroidRuntime(350): at java.lang.reflect.Method.invoke(Method.java:507)
11-28 12:13:06.113: E/AndroidRuntime(350): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-28 12:13:06.113: E/AndroidRuntime(350): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-28 12:13:06.113: E/AndroidRuntime(350): at dalvik.system.NativeStart.main(Native Method)
ありがとう。