I'm making an app that, among other things, lets users add events to their phone's calendar to "track seizures". Here's the code I have to create the event:
What I want is when they push the button an AlertDialog pops up (and it does), containing an EditText to let the user give the description. When they click "OK" in the AlertDialog, I want the event to be created right then. Instead, it just brings up the screen you'd get if you went to the calendar app and went to add an event. Can I skip that screen altogether?
Sorry if this is confusing, ask if anything needs clarifying. Thanks!
Code:
Intent calIntent = new Intent(Intent.ACTION_INSERT);
calIntent.setType("vnd.android.cursor.item/event");
calIntent.putExtra(Events.TITLE, "Tracked seizure");
calIntent.putExtra(Events.DESCRIPTION, value);
Calendar c=Calendar.getInstance();
GregorianCalendar calDate = new GregorianCalendar(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
c.get(Calendar.HOUR));
calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
c.get(Calendar.HOUR));
startActivity(calIntent);
Sorry if this is confusing, ask if anything needs clarifying. Thanks!