I want to open the Calendar application from an Android application

I want to open the Calendar application from an Android application. When I searched the Internet, all I got was this code. But it did not work under Android android 2.1. Can I launch the Calender application from an Android application under 2.1? If possible, someone can help me with this.

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); 
+2
source share
3 answers
 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); 
+1
source

To start an event to add 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
source

Source: https://habr.com/ru/post/1487245/


All Articles