Note that there are some explanatory texts on larger screens.

plurals
  1. POonActivityResult isn't getting the proper result after returning because the activty that called it was re-created?
    primarykey
    data
    text
    <p>I have two activities: PictureList and AddPictures. From the activity PictureList I'm requesting an activity for result like this:</p> <pre><code>Intent myIntent = new Intent(PictureList.this, AddPictures.class); Bundle b = new Bundle(); b.putInt("iEntry", clickCounter); b.putBoolean("bAddPicture", true); b.putBoolean("bEditPicture", false); myIntent.putExtras(b); startActivityForResult(myIntent,1); </code></pre> <p>I'm also implementing the corresponding onActivityResult here:</p> <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { if(resultCode == RESULT_OK){ iReturnedEntry = data.getIntExtra("iReturnedEntry", 0); } if (resultCode == RESULT_CANCELED) { } } } } </code></pre> <p>On the other activity, AddPictures, receives the parameters: </p> <pre><code>Bundle b = getIntent().getExtras(); iEntry = b.getInt("iEntry"); bAddPicture = b.getBoolean("bAddPicture", false); bEditPicture = b.getBoolean("bEditPicture", false); </code></pre> <p>and when it has to return it does it like this:</p> <pre><code>Intent returnIntent = new Intent(); returnIntent.putExtra("iReturnedEntry", iEntry); setResult(RESULT_OK,returnIntent); </code></pre> <p>Normally the application works fine, but very often it happens that the result isn't stored. I think that because of some memory management or other reason the PictureList activity is re-creating, or it is calling the onCreate method again after returning from the activity AddPictures and because of this the onActivityResult isn't working. How can I solve this issue? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload