I want to develop an application in android where i want to add events in calender through my application also to see them from my application ,how can i do that , any tutorial or suggestion would be helpful
the logcat file is
06-24 10:09:17.056: ERROR/ActivityThread(610): Failed to find provider info for calendar
06-24 10:09:17.076: DEBUG/AndroidRuntime(610): Shutting down VM
06-24 10:09:17.076: WARN/dalvikvm(610): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): FATAL EXCEPTION: main
06-24 10:09:17.107: ERROR/AndroidRuntime(610): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.jimblackler.readcalendar/net.jimblackler.readcalendar.MainActivity}: java.lang.NullPointerException
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at android.os.Handler.dispatchMessage(Handler.java:99)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at 开发者_如何学JAVAandroid.os.Looper.loop(Looper.java:123)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at android.app.ActivityThread.main(ActivityThread.java:3647)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at dalvik.system.NativeStart.main(Native Method)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): Caused by: java.lang.NullPointerException
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at net.jimblackler.readcalendar.Example.readCalendar(Example.java:30)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at net.jimblackler.readcalendar.MainActivity.onCreate(MainActivity.java:13)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
06-24 10:09:17.107: ERROR/AndroidRuntime(610): ... 11 more
06-24 10:09:17.137: WARN/ActivityManager(68): Force finishing activity net.jimblackler.readcalendar/.MainActivity
06-24 10:09:18.486: WARN/ActivityManager(68): Activity pause timeout for HistoryRecord{406c0978 net.jimblackler.readcalendar/.MainActivity}
06-24 10:09:19.477: INFO/ActivityManager(68): Process com.google.android.apps.maps:FriendService (pid 589) has died.
06-24 10:09:20.736: WARN/InputManagerService(68): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40736c08
06-24 10:09:21.236: DEBUG/dalvikvm(68): GC_CONCURRENT freed 947K, 44% free 4739K/8327K, external 1426K/1936K, paused 32ms+43ms
06-24 10:09:21.275: INFO/Process(610): Sending signal. PID: 610 SIG: 9
06-24 10:09:21.287: INFO/dalvikvm(446): Wrote stack traces to '/data/anr/traces.txt'
06-24 10:09:21.327: INFO/ActivityManager(68): Process net.jimblackler.readcalendar (pid 610) has died.
try thsi code
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent,0);
As the android calendar usually is connected to the Google Calendar, why not use the Google Calendar API? Have a look here:
http://code.google.com/intl/de-DE/apis/calendar/
Instead of the Google API you could also use the CalDAV Protocol, which makes it easier to switch to some other calendar backend later on.
精彩评论