I am developing an Android application that requests a calendar application for editing events.
I use startActivityForResult() to open a calendar. After editing and saving the event, resultCode always inside onActivityResult() .
I saw a lot of answers related to "onActivityResult resultCode always returns 0". This is because the second action does not use setResult() and finish() .
But in my case, I call the Android calendar application (not a custom action).
Code for the request in the Android calendar:
Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event");
To start or save the calendar
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
I click "Save" or "Cancel" in the calendar application, resultCode always gives 0.
In addition, I need to return data from the intent of the calendar. But the intent βdataβ in onActivityResult also returns null.
Can anyone explain why this is happening? Is there a way to find out if the user clicks "Save" or "Cancel"?
source share