开发者

Open Calendar in Android

开发者 https://www.devze.com 2023-02-13 17:27 出处:网络
H开发者_JAVA技巧ow to open Calendar on Button Click and get clickable Date.check this out: http://www.developer.com/ws/article.php/3850276/Working-with-the-Android-Calendar.htm

H开发者_JAVA技巧ow to open Calendar on Button Click and get clickable Date.


check this out: http://www.developer.com/ws/article.php/3850276/Working-with-the-Android-Calendar.htm

EDIT:

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


Try using the CalendarView widget, see docs here

This isn't a dialog, so you'd have to create a dialog, wrap it around a CalendarView and launch it yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消