我想从我的应用程序启动日历,这样我就可以让用户把自己的任命,然后有我的应用程序读取的。
I am trying to Launch a calendar from my app, so I can let users put their appointments to it and then have my app read those.
我试了一片code的我发现在这里:
I tried the piece of code I found on here:
ComponentName cn;
Intent i = new Intent();
cn = new ComponentName("com.google.android.calendar", "com.android.calendar.LaunchActivity");
i.setComponent(cn);
startActivity(i);
和得到的错误
07-07 21:05:33.944:ERROR / AndroidRuntime(1089):android.content.ActivityNotFoundException:产生的原因无法找到明确的活动类{com.google.android.calendar / COM .android.calendar.LaunchActivity};有你在你的AndroidManifest.xml宣布这项活动?
我做了声明 com.android.calendar.LaunchActivity
我的Android清单文件,它仍然是不工作...
I did declare the com.android.calendar.LaunchActivity
to my android manifest file and it still isn't working...
标识使用模拟器这不是可行?我在honeycomb3.0这样
Id this not doable using the emulator? I am doing this in honeycomb3.0
此,从Andriod的文档,为我工作:
This, from Andriod docs, worked for me:
long startMillis = System.currentTimeMillis();
Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
builder.appendPath("time");
ContentUris.appendId(builder, startMillis);
intent = new Intent(Intent.ACTION_VIEW).setData(builder.build());
startActivity(intent);
此处了解详情:Android日历文档。