android - Update activity from another activity -


i have activity 1,2 , 3. when clicked button in activity 1, show activity 2. when clicked button in activity 2, show activity 3. activity shown.

when clicked button in activity 3, want display image in activity 1. how can that?

thanks.

from firstactivity call secondactivity using startactivityforresult() method

for example:

intent = new intent(this, secondactivity.class); startactivityforresult(i, 1); 

in secondactivity set data want return firstactivity. if don't want return back, don't set any.

for example: in secondactivity if want send data:

intent returnintent = new intent(); returnintent.putextra("result",result); setresult(result_ok,returnintent); finish(); 

if don't want return data:

intent returnintent = new intent(); setresult(result_canceled, returnintent); finish(); 

now in firstactivity class write following code onactivityresult() method.

protected void onactivityresult(int requestcode, int resultcode, intent data) {      if (requestcode == 1) {         if(resultcode == result_ok){             string result=data.getstringextra("result");         }         if (resultcode == result_canceled) {             //write code if there's no result         }     } }//onactivityresult 

for more reference click here


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -