well my code is:
public void onClick(View v) {
if(task.isEventSet()==false) {
Calendar c=Calendar.getInstance();
c.set((int)task.getTaskYear(),(int) task.getTaskMonth(), (int)task.getTaskDay(), (int)task.getTaskHour(), (int)task.getTaskMinute());
Intent i=new Intent(Intent.ACTION_INSERT);
i.setData(Events.CONTENT_URI);
i.putExtra(Events._ID, task.getId());
i.putExtra(Events.TITLE, task.getName());
i.putExtra(Events.EVENT_LOCATION, task.getLocation());
i.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, c.getTimeInMillis());
task.setEventSet(true);
context=v.getContext();
context.startActivity(i);
}
My Question is when I click on an icon the calendar application pops up where I can store my event details. Suppose if I press cancel or OK button durng the setup of an event, what is the response code returned by the calendar? I need to use this response code to set the task.setEventSet depending on the action performed..
Take a look at
startActivityForResult()instead ofstartActivity().http://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)
You’ll get a callback to
onActivityResult()with the response code.