Open an activity twice but with different values

0

AndroidManifest:

<activity android:name=".pictureManagement.boundary.DocsIDUI"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:screenOrientation="portrait"
        android:launchMode="singleTask">

    </activity>

    <activity android:name=".pictureManagement.boundary.PicturePreview"
        android:screenOrientation="portrait"
        android:launchMode="singleTask">

    </activity>

Activity DocsIDUI:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
        if (photoFile != null) {
            imageUri = Uri.fromFile(photoFile);

            Intent intent = new Intent(DocsIDUI.this, PicturePreview.class);
            Bundle bundle = new Bundle();
            bundle.putSerializable(PicturePreview.NAME, name);
            if (!isBackStep)
            {
                bundle.putSerializable(PicturePreview.STEP, 0);
            } else
            {
                bundle.putSerializable(PicturePreview.STEP, 1);
            }
            bundle.putSerializable(PicturePreview.URI_PHOTO, imageUri.toString());
            intent.putExtras(bundle);
            DocsIDUI.this.startActivity(intent);

        }
    }
}

Activity PicturePreview:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_picture_preview);

    getNewIntent(getIntent());

    getImage();

    getComponents();

    setListeners();
}

@Override
protected void onResume(){
    super.onResume();

    getNewIntent(getIntent());
}
private void getNewIntent(Intent intent) {
    if (intent != null && intent.hasExtra(URI_PHOTO)) {
        this.stringUri = (String) intent.getSerializableExtra(URI_PHOTO);
        imageUri = Uri.parse(stringUri);
    }
    if (intent != null && intent.hasExtra(NAME)) {
        this.name = (String) intent.getSerializableExtra(NAME);
    }
    if (intent != null && intent.hasExtra(STEP)) {
        this.step = (int) intent.getSerializableExtra(STEP);
    }
}

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
}

When you first open the activity PicturePreview (DocsIDUI -> PicturePreview), it opens normally, but when the return is made and the PicturePreview is opened a second time, when isBackStack is positive, it does not open by going directly

    
asked by anonymous 13.01.2016 / 19:16

1 answer

0

The way I found it was to change within the manifest the "launchMode"

android:launchMode="singleInstance"
    
14.01.2016 / 17:15