I can open a Android event from my activity using the Events.CONTENT_URI intent. I can edit the opened event in the Event Edit screen. However, when I try to add an attachment to the event, it crashes with NullPointerException:
Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, event_id);
Intent intent = new Intent(Intent.ACTION_VIEW).setData(uri);
intent.putExtra("beginTime", startMillis);
intent.putExtra("endTime", endMillis);
startActivity(intent);
When I add an attachment in the Android Event Edit screen, the Android Event Edit screen crashes with the following error:
03-08 22:57:39.711: E/AndroidRuntime(18646): FATAL EXCEPTION: main
03-08 22:57:39.711: E/AndroidRuntime(18646): Process: com.google.android.calendar, PID: 18646
03-08 22:57:39.711: E/AndroidRuntime(18646): java.lang.NullPointerException: Attempt to invoke interface method 'void com.android.calendar.ActivityResultNotifications$ActivityResultNotifierActivity.registerActivityResultListener(com.android.calendar.ActivityResultNotifications$ActivityResultListener)' on a null object reference
03-08 22:57:39.711: E/AndroidRuntime(18646): at com.google.android.calendar.event.edit.segment.AttachmentsEditSegment.registerForActivityResult(AttachmentsEditSegment.java:522)
03-08 22:57:39.711: E/AndroidRuntime(18646): at com.google.android.calendar.event.edit.segment.AttachmentsEditSegment.openFilePicker(AttachmentsEditSegment.java:113)
03-08 22:57:39.711: E/AndroidRuntime(18646): at com.google.android.calendar.event.edit.segment.AttachmentsEditSegment.onClick(AttachmentsEditSegment.java:102)
03-08 22:57:39.711: E/AndroidRuntime(18646): at android.view.View.performClick(View.java:4756)
03-08 22:57:39.711: E/AndroidRuntime(18646): at android.view.View$PerformClick.run(View.java:19749)
03-08 22:57:39.711: E/AndroidRuntime(18646): at android.os.Handler.handleCallback(Handler.java:739)
03-08 22:57:39.711: E/AndroidRuntime(18646): at android.os.Handler.dispatchMessage(Handler.java:95)
03-08 22:57:39.711: E/AndroidRuntime(18646): at android.os.Looper.loop(Looper.java:135)
03-08 22:57:39.711: E/AndroidRuntime(18646): at android.app.ActivityThread.main(ActivityThread.java:5221)
03-08 22:57:39.711: E/AndroidRuntime(18646): at java.lang.reflect.Method.invoke(Native Method)
03-08 22:57:39.711: E/AndroidRuntime(18646): at java.lang.reflect.Method.invoke(Method.java:372)
03-08 22:57:39.711: E/AndroidRuntime(18646): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
03-08 22:57:39.711: E/AndroidRuntime(18646): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
I would appreciate it if anyone could give me some idea.
Thanks, Cow.