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

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -