在Android开放日历日历、Android

2023-09-05 01:18:45 作者:止于枯骨

如何打开日历上的按钮点击,并获得点击的日期。

How to open Calendar on Button Click and get clickable Date.

推荐答案

检查了这一点:的http://www.developer.com/ws/article.php/3850276/Working-with-the-Android-Calendar.htm

编辑:

从按钮的Click事件打开日历添加这个code到的onClick方法:

To open calendar from button click event add this code to onClick method:

Intent i = new Intent();

//Froyo or greater (mind you I just tested this on CM7 and the less than froyo one worked so it depends on the phone...)
cn = new ComponentName("com.google.android.calendar", "com.android.calendar.LaunchActivity");

//less than Froyo
cn = new ComponentName("com.android.calendar", "com.android.calendar.LaunchActivity");

i.setComponent(cn);
startActivity(i);