The code Written below works for me
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", "Hi this me");
intent.putExtra("description", "Some description");
intent.putExtra("beginTime", eventStartInMillis);
intent.putExtra("endTime", eventEndInMillis);
startActivityForResult(intent, 1);
my question is that i can't back the android calendar data in OnActivityResult, i don't know why please help me for this issue.
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if(resultCode == RESULT_OK){
String result=data.getStringExtra("title");
}
And i am getting data.getExtras() is null !!!!!
It s Because Result code always Return 0 In android calendar Activity result of Calendar implicit intent try using RESULT_CANCEL in onActivity result
public void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
switch (reqCode) {
if (resultCode == Activity.RESULT_CANCEL)
And You Have to just Check out Next Event ID it will working Hope it will Help to you..
Govind
If you look at the official documentation: http://developer.android.com/reference/android/app/Activity.html#setResult(int, android.content.Intent) you will see that the Intent you get in onActivityResult() is actually dependent on the Activity you are calling. More specifically it depends on whether the called Activity uses setResult(int, android.content.Intent) with an Intent with extras or not.
From a quick internet search it seems that the code you are using is for adding an event in the Calendar, but that does not neccessary mean that you will get the event data back from the Calendar app. Perhups you have to query the Calendar afterwards to get them.
As for the Contacts app, it specifically states so in the Contacts Provider Guide, that you can get the contact data in onActivityResult() if you use startActivityForResult. In the Calendar Provider Guide there is no such statement, so it is probably not supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With