Niranj Patel
Niranj Patel

Reputation: 33238

Open Calendar in Android

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

Upvotes: 0

Views: 8301

Answers (2)

evilone
evilone

Reputation: 22740

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

Upvotes: 4

James Booker
James Booker

Reputation: 108

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.

Upvotes: 0

Related Questions