开发者

I want to open up the Calendar application from an android application

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 i开发者_运维问答t 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);


I also recommend this: How to launch Android Calendar application using Intent (Froyo)


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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜