Why activity result code is diffrent then I expected
Posted
by Fisher
on Stack Overflow
See other posts from Stack Overflow
or by Fisher
Published on 2010-06-15T23:38:25Z
Indexed on
2010/06/15
23:42 UTC
Read the original article
Hit count: 164
android
I have 2 activities. In child activity i have put something like that in onPause():
if (isFinishing()) {
final Intent intent = new Intent();
intent.putExtra(SOME_DATA, value);
setResult(RESULT_OK, intent);
Log.i("test", "Result set to RESULT_OK");
}
In parent activity i check resultCode when child activity is destroyed, and this is what i have noticed:
- If i destroy child activity by some action (in some condition i invoke finish()), then resultCode is RESULT_OK
- But when i destroy by pressing return key (i works only in emulator so its ESC) who kills activity, then resultCode read in parent onActivityResult method equals 0 (RESULT_CANCELD).
"test" log read in each case is the same.
© Stack Overflow or respective owner