3

I am using this code in my application and getting following page.

Intent calendarIntent = new Intent(Intent.ACTION_EDIT);  
            calendarIntent.setType("vnd.android.cursor.item/event");
            calendarIntent.putExtra("title", "Title");
            calendarIntent.putExtra("beginTime", new Date());
            calendarIntent.putExtra("endTime", new Date(2013,7,7));
            calendarIntent.putExtra("description", "Description");

            startActivity(calendarIntent);

enter image description here

but I want this page

enter image description here

what should I change in my code. please help me.

enter image description here

Jignesh Ansodariya
  • 12,583
  • 24
  • 81
  • 113

1 Answers1

1

Try this :

    long startMillis;
    ...
    Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
    builder.appendPath("time");   
    ContentUris.appendId(builder, startMillis);
    Intent intent = new Intent(Intent.ACTION_VIEW).setData(builder.build());
    startActivity(intent);
Tanuj Wadhwa
  • 2,025
  • 9
  • 35
  • 57