Home > Mobile >  To jump different instances of the same Activity class start
To jump different instances of the same Activity class start

Time:12-03

From A Activity jump B1 Activity, B1 jump back into A B1 do not finish it, and then from A jump B2 Activity, B2 jump back into A but not finish, B2 B1 and B2 are the same Activity start different instances of the class, now I need from A jump to the existing B1, I try to add Intent before A jump. FLAG_ACTIVITY_REORDER_TO_FRONT, will only jump to the nearest B2. Try to add the action, the category is to jump to the nearest B2, can I get to the entire Activity stack but seems to be not much in the way of lifting the Activity except startActivity, attach A return A Activity code,

Intent Intent=new Intent (B1. This, A.c lass); Intent. SetFlags (intent. FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent);

CodePudding user response:

New B2 when using the Flag set dynamically singleInstance startup mode, he will exist in a separate activity stack, will not affect the current stack jump, according to your actual demand, generally the same activity stack there exist two different entities of the same type is not reasonable to have to also very waste, although I don't know what you need, but boot mode is to try to solve your problem,

CodePudding user response:

Or you tell me about your requirements, why to be realized, the great god who might have a better solution, don't need such a jump

CodePudding user response:

Brothers, the Activity of the boot mode of these I know, now I just don't want to reuse the Activity, because I demand dynamically created controls within the Activity are the same, but the load for a complicated time, just a few pages, the whole software for memory overhead don't need to think too much, I now is the second time to open the new Activity do not need to create (there is a load time) can show directly, and then I tried the above, the purpose is to open the specified Activity instance, these instances in the stack by the same Activity class new, I am not a novice, to boot mode and flag is very understand, but I met this problem, you test not in method, in order to achieve the demand I use fragments switch is ok, but - the goal is to open the specified Activity instance

CodePudding user response:

Get along while, we may not be able to use stack should be to solve, B1B2 into two Activity, or use two fragments

CodePudding user response:

Activity. MoveTaskToBack??

CodePudding user response:

Mobile version of the WPS should be have a similar function
  • Related