简体   繁体   中英

Calendar resultCode on android

There is a similar question on stackoverflow already, but it have not been answered properly so i'll ask again.

I'm creating an event using:

Intent intCalendar = new Intent(Intent.ACTION_EDIT);
intCalendar.setType("vnd.android.cursor.item/event");
startActivityForResult(intCalendar, 1);

and tried checking if the event was created using

 public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    switch (requestCode) {
       case 1:
          if (resultCode == RESULT_OK) {}
    }
 }

But the thing is, i have to know in the app that i'm developing if the user pressed "SAVE" or "CANCEL" while creating the event. The problem is that calendar doesn't give me a resultCode.

Is there a way that i can check if the user pressed "CANCEL" or "OK" without result code?

Note: I'm new to Android.

i have to know in the app that i'm developing if the user pressed "SAVE" or "CANCEL" while creating the event

Then you will need to work with CalendarContract , instead of using ACTION_EDIT .

The problem is that calendar doesn't give me a resultCode.

It is not supposed to give you a result code. ACTION_EDIT has no output .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM