2011-06-21 78 views
1

我想開發在Android的,我想通過我的應用程序添加壓延機事件也看到他們從我的應用程序的應用程序,我怎麼能做到這一點,任何教程或建議將是有益的如何在我的應用程序中使用android日曆?

的logcat的文件

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 android.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.IInputMethodClien[email protected] 
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. 
+0

設備RU使用其 – kannappan

+0

其對於API 2.3.1仿真器,還沒有關於設備 –

+1

你好模擬器測試它不支持calender.pls嘗試這在device.there被沒有日曆API模擬器 – kannappan

回答

1

嘗試thsi代碼

Intent intent = new Intent(Intent.ACTION_EDIT); 
intent.setType("vnd.android.cursor.item/event"); 
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
startActivityForResult(intent,0); 
+0

你能告訴我如何使用這段代碼,因爲當我使用這段代碼時,log cat顯示錯誤06-24 10:09:17.056: ERROR/ActivityThread(610):無法找到日曆 –

+0

的提供者信息,如果您使用此代碼,它將顯示日曆應用程序中的添加事件活動。 – kannappan

+0

但我的應用程序只是崩潰沒有開始 –

1

由於android日曆通常連接到Google日曆,爲什麼不使用Google Calendar API呢?看看這裏:

http://code.google.com/intl/de-DE/apis/calendar/

取而代之的是谷歌API,你也可以使用的CalDAV協議,這使得它更容易切換到其他一些日曆後端以後。

+0

thanx答案,你可以告訴我,當我們使用谷歌APi它做出獨立的應用程序,或者我們需要互聯網來讓它工作 –

+0

如果你需要這個脫機工作,我的方法使用谷歌日曆不會工作。在這種情況下,您必須直接從系統日曆中訪問sql數據(這不如使用所提到的API好),下面是一個相當不錯的教程:http://www.developer.com/ws /article.php/3850276/Working-with-the-Android-Calendar.htm – HefferWolf

相關問題