I want to open calendar from my app and pass parameter "Date" to this calendar.
And this calendar would display the Date's corresponding date page.
I have surveyed source code of calendar , but not found ways to use.
public static void openCalendarApp(Context context)
{
Intent intent = context.getPackageManager().getLaunchIntentForPackage("com.android.calendar");
context.startActivity(intent);
}
you can use the calendar view to do this... use the setDate(long date)
method to set the date on the calendar to the date you want
you can also do this by adding events to the calendar like so
The intent to create a calendar
Intent calIntent = new Intent(Intent.ACTION_INSERT);
calIntent.setData(CalendarContract.Events.CONTENT_URI);
startActivity(calIntent)
Seeding Calendar Dates and Times
Intent calIntent = new Intent(Intent.ACTION_INSERT);
calIntent.setType("vnd.android.cursor.item/event");
calIntent.putExtra(Events.TITLE, "Title here");
calIntent.putExtra(Events.EVENT_LOCATION, "Location here");
calIntent.putExtra(Events.DESCRIPTION, "Description here");
GregorianCalendar calDate = new GregorianCalendar(2012, 7, 15);
calIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true);
calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
calDate.getTimeInMillis());
calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
calDate.getTimeInMillis());
startActivity(calIntent);
an example of this can be seen here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With