2014-04-30 109 views
2

我想從我的應用程序中打開Goog​​le日曆應用程序。我有以下的代碼,但它崩潰:如何從我的應用程序打開谷歌日曆應用程序?

if (Utils.isPackageInstalled(PACKAGENAME,getApplicationContext())) { 
    intent = new Intent(Intent.ACTION_VIEW, Uri.parse("com.android.calendar")); 
    startActivity(intent); 
} 

的logcat:

04-30 09:14:29.156: E/AndroidRuntime(21225): FATAL EXCEPTION: main 
04-30 09:14:29.156: E/AndroidRuntime(21225): Process: com.am, PID: 21225 
04-30 09:14:29.156: E/AndroidRuntime(21225): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=com.android.calendar } 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.app.Activity.startActivityForResult(Activity.java:3424) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.app.Activity.startActivityForResult(Activity.java:3385) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.app.Activity.startActivity(Activity.java:3627) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.app.Activity.startActivity(Activity.java:3595) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at com.amexbarcelo.activity.RootActiveTravel$4.onClick(RootActiveTravel.java:147) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.os.Handler.dispatchMessage(Handler.java:102) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.os.Looper.loop(Looper.java:136) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at android.app.ActivityThread.main(ActivityThread.java:5017) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at java.lang.reflect.Method.invokeNative(Native Method) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at java.lang.reflect.Method.invoke(Method.java:515) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
04-30 09:14:29.156: E/AndroidRuntime(21225): at dalvik.system.NativeStart.main(Native Method) 
+2

參考文獻:[谷歌日曆](https://play.google.com/store/apps/details?id=com.google .android.calendar),好像你的包名是錯的? – Aprian

+0

這是解決方案intent = manager.getLaunchIntentForPackage(PACKAGENAME); \t intent.addCategory(Intent.CATEGORY_LAUNCHER); – Cabezas

+0

正確的包名是「com.google.android.calendar」 – Cabezas

回答

相關問題