如何使用日历意图在android系统? [英] How to use Calendar Intent in android?

查看:328
本文介绍了如何使用日历意图在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的应用程序启动日历,这样我就可以让用户把自己的任命,然后有我的应用程序读取的。

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};有你在你的Andr​​oidManifest.xml宣布这项活动?

我做了声明 com.android.calendar.LaunchActivity 我的Andr​​oid清单文件,它仍然是不工作...

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);

此处了解详情:
<一href=\"http://developer.android.com/guide/topics/providers/calendar-provider.html#intent-view\">Android日历文档。

这篇关于如何使用日历意图在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆