Questions about Android activity (startActivity, int, task)

Asked 2 years ago, Updated 2 years ago, 25 views

When you have an Android activity, There should be only one A, B, and C will be stacked several times.

A -> C -> C -> B -> C -> C -> B -> C when called in order

I'd like to stay AC C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C

1. Even if B is called again using FLAG_ACTIVITY_REORDER_TO_FRONT, the existing B is not pulled to the top as per the document. (AC C B C C C C remain as it is)

2. If you use singleTask during launch mode, After AC BC'C'C', when calling B, the existing BC'C flies away AC CB'C'C'C'C'C'C'C'C'C'C'C'C'C'C'C'C'C'C'C'C'C'.

3. I just need to pull activity B forward using FLAG_ACTIVITY_REORDER_TO_FRONT, but I don't know why it doesn't work even if I refer to the document.

C is starting activation by setting FLAG_ACTIVITY_REORDER_TO_FRONT, and A and B do not give any special settings.

If anyone knows, please answer.

Add +++

int = new Intent (this, SubActivity.class);
intent.putExtra("data", data);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

This is the corresponding code, but if you take the int flag value in the getIntent part, the new_task is also taken. The content is not in the documentation document, but I think this is a problem, how should I handle it? It can't be solved with removeflag and the api version is too high.

android

2022-09-20 21:51

1 Answers

This bug is https://issuetracker.google.com/issues/36986021#c2

This is a 2013 issue, and bugs are occurring in 4.4, 7.0, and 7.1. (s6, reproduced in 7.0 version)

It is estimated that the versions with this problem are forced to give new_task during startActivity. The workaround is in the link.


2022-09-20 21:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.