android - startActivityForResult and setResult with RESULT_OK does not work -
i'm not sure if expected behavior, if following in oneactivity
launch twoactivity
:
intent intent = new intent(this, twoactivity.class); startactivityforresult(intent, result_ok);
and in twoactivity
when pass oneactivity
:
intent resultintent = new intent(); resultintent.putextra(source, tag); setresult(result_ok, resultintent); finish();
with above code , after overriding onactivityresult
in oneactivity
nothing happens. onactivityresult
doesn't seem called. if, however, change result_ok
0
, works.
is expected? has else experienced that?
check out docs definition of startactivityforresult method. says:
requestcode int: if >= 0, code returned in onactivityresult() when activity exits.
so request code should >= 0. if check value of result_ok response code, it's -1. it's important note request code isn't same result code. request code serves identify request result for, , result code tells if request successful or not.
Comments
Post a Comment