0

我想从我的小部件应用程序中打开一个日历(例如,谷歌日历)。我做了这样的事情:

    Intent intent2 = new Intent();
    //Froyo or greater 
    ComponentName cn = new ComponentName("com.google.android.calendar", "com.android.calendar.LaunchActivity");
    intent2.setComponent(cn);
    PendingIntent pendingIntent2 = PendingIntent.getActivity(context, 1,
            intent2, 0);

    updateViews.setOnClickPendingIntent(R.id.calendar, pendingIntent2);

但它不起作用。有什么帮助吗?

非常感谢

4

1 回答 1

0

最后它起作用了:

    Intent intent2 = new Intent();
    ComponentName cn = new ComponentName("com.android.calendar",
            "com.android.calendar.LaunchActivity");
    intent2.setComponent(cn);
    PendingIntent pendingIntent2 = PendingIntent.getActivity(context, 1,
            intent2, 0);
    updateViews.setOnClickPendingIntent(R.id.calendar, pendingIntent2);

在清单中:

    <activity
        android:name="com.android.calendar.LaunchActivity">
    </activity>
于 2012-12-17T19:14:40.520 回答