I sent it from an activity called A to an activity called B from Android to startActivityForResult.
When B-Activity ended the screen, I set the result value as setResult and sent it to you
A activity has only zero result value
The actual value sent should be only one of the two 1000/1001 values.
The content value is also null, but there is no strange log on the log.
I have no idea what the problem is.
If you have this kind of experience, please help me.
Blockquote Start activity sending part
Intent cIntent = new Intent(Activity_searchs.this, Activity_Search_Result.class);
cIntent.putExtra("SearchWord", s);
cIntent.putExtra("is_store", isStore);
startActivityForResult(cIntent, 7777);
Blockquote SetResult part
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (LMain.refreshFlag) {
setResult(nResult);
}
finish();
}
});
OnActivityResult part
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.e("SJW", "RequestCode > "+requestCode+" / resultCode > "+resultCode);
if(requestCode == 7777){
if(resultCode == 1001){
finish();
}
}
}
It looks like this.
In the onActivityResult part, the resultCode always enters only 0.<
android
The first parameter of setResult is a value to pass values such as RESULT_CANCELED or RESULT_OK. If you want to deliver the result as a value, setResult as below.
Intent returnIntent = new Intent();
returnIntent.putExtra("result",1000);
setResult(RESULT_OK,returnIntent);
finish();
Read data.getIntExtra("result",0);
on the side where you read the value. 0 is the default value if the value cannot be read.
Could you correct the question and upload the code for the SetResult and the onActivityResult?
If you see the result value as 0, it seems that the default value is entered in getIntExtra
.
554 Uncaught (inpromise) Error on Electron: An object could not be cloned
553 GDB gets version error when attempting to debug with the Presense SDK (IDE)
556 PHP ssh2_scp_send fails to send files as intended
554 Understanding How to Configure Google API Key
555 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.