dominic
dominic

Reputation: 318

Android Calendar Event Add/Create Component

All,

I am searching for an component i.e the Android Event creation/add screen in the calendar.The component looks like the one in the image below. No problem which ever the OS version it may be. I wanna achieve the way this standard android event screen can be called within an app. iOS provides this kind of feature, does android also do?

Thanks, In advance!

enter image description here

Upvotes: 0

Views: 610

Answers (1)

Anu
Anu

Reputation: 551

Write the below code in your event Onclicklistner

Calendar cal = Calendar.getInstance();              
        Intent intent = new Intent(Intent.ACTION_EDIT);
        intent.setType("vnd.android.cursor.item/event");
        intent.putExtra("beginTime", cal.getTimeInMillis());
        intent.putExtra("allDay", true);
        intent.putExtra("rrule", "FREQ=YEARLY");
        intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000);
        intent.putExtra("title", "A Test Event from android app");
        startActivity(intent);

Upvotes: 1

Related Questions