I want to open up the Calendar application from an android application. When i searched online, all i got this code.but it didn't work the below android 2.1. Is it possible to launch Calender application from an android application below 2.1? If possible, could someone please help me with it.
Calendar tempCal = (Calendar) mCalendar.clone();
tempCal.set(year, month, day);
Intent calendarIntent = new Intent() ;
calendarIntent.putExtra("beginTime", tempCal.getTimeInMillis());
calendarIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
calendarIntent.setClassName("com.android.calendar","com.android.calendar.AgendaActivity");
startActivity(calendarIntent);
我也建议这样做: 如何使用Intent(Froyo)启动Android日历应用程序
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", "Some title");
intent.putExtra("description", "Some description");
intent.putExtra("beginTime", eventStartInMillis);
intent.putExtra("endTime", eventEndInMillis);
startActivity(intent);
To launch the activity for adding an event to the calendar, use:
Intent intent = new Intent(); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", startTimeInMilliseconds); intent.putExtra("endTime", endTimeInMilliseconds); intent.setAction(Intent.ACTION_EDIT); startActivity(intent);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.