Activity不调用onActivityResult()方法的原因
问题描述:
在Activity中采用startActivityForResult(intent, requestCode)方式激活AnotherActivity.
当AnotherActivity执行:
Intent intent=new Intent();
intent.putExtra("test", "hello");
setResult(RESULT_OK, intent);
finish();
此时在该Activity中并未执行和调用onActivityResult方法:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
错误原因:
在Activity中执行startActivityForResult(intent, requestCode)时requestCode必须大于等于0
补充:移动开发 , Android ,