I have 2 actions AAA and BBB. I call BBB from AAA using startActivityForResult (Intent, int) . After I finished with BBB, I click the back button to return to AAA. In BBB, I override onPause () and set the result using setResult (RESULT_OK) .
In AAA, I check my result on onActivityResult (int requestCode, int resultCode, Intent data) , and I keep getting RESULT_CANCELLED.
After spending some time in google / stackoverflow, I realized that if I override onBackPressed () and set the result in it, then it works absolutely fine.
What I don't understand is why the result is not set in onPause (), when onPause () is actually called after onBackPressed (). I went through activity streams in Dev docs, and I understand quite clearly what was mentioned there.
Has anyone got any ideas about this behavior or could explain it better?
source
share