My app starts an intent to call calendar app inserting an events with these codes
Intent intent = new Intent(Intent.ACTION_INSERT)
.setData(Events.CONTENT_URI)
.putExtra(Events.DTSTART, date.getTime())
.putExtra(Events.DTEND, date.getTime() + DateUtils.HOUR_IN_MILLIS)
.putExtra(Events.EVENT_TIMEZONE, TimeZone.getDefault().getDisplayName());
startActivityForResult(intent,EDIT_EVENT_AGENDAUI);
//startActivity(intent); dosent make any difference
As you can see here, it calls a calendar insert page.
but it is weird that it wont go back to my app instead of go back to calendar view
after i click “Done”. I have to click “back” button on screen to return to my app
this is kinda unfriendly
googled a half day
it seems no one gets this problem.
Any ideas? Thanks
PS
- i am using Android ICS on Virtual Machine
- if i click “cancel” to quit the page, it acts as i expected — go back to my app. This is good, but much more confused me.
What you are experiencing is the correct behavior. I’m not aware of any shortcut for just adding an event without going into the calendar activity, unless there are some public content provider for the calendar.
Especially in ICS the add-event window might just be a Fragment included in the calendar activity, so it makes perfect sense that you see your event after you have clicked save.