Wrote a simple page jump method, but I found that has been running is not successful, jump to the ActivityTwo ActivityOne and end, with the finish () function, but I found I finish each invocation will all come to an end I the whole program, is android version? Please bosses some directions me
CodePudding user response:
With a look at your code
CodePudding user response:
reference 1/f, fei, higher response: paste have a look at your code Public class ActivityA extends the Activity { Public void onCreate (Bundle savedInstanceState) { Super. OnCreate (savedInstanceState); The setContentView (R.l ayout. Adaptive); StartActivity (new Intent (ActivityA. This, ActivityB. Class); ActivityA. This. Finish (); } } In this way, after the jump was killed the entire program, and then I put the finish () into onDestory (), and then success, Entrance to the activity cannot use finish () to put an end to himself? This will kill the process? I am a little stupid, I were written as before, CodePudding user response:
Compile time startActivity fewer parenthesis will not go wrong CodePudding user response:
1. The crash stack up, look "2. OnDestory you cannot explicitly call CodePudding user response:
In 2019, the latest summary, from the programmer to CTO, from professional excellence, Daniel share document PDF and PPT to sort out https://github.com/0voice/from_coder_to_expert CodePudding user response:
Huan reference 3 floor wood response: startActivity less a compile time brackets will not go wrong yao That's my hand, playing less to play CodePudding user response:
1. The call can finish to end the current activity 2. What is your call finish? Collapse? Still no results, CodePudding user response:
Do all interface program crash looks out of the, the finfish can cancel normal jump CodePudding user response:
refer to 7th floor gxh_apologize response: 1. The call can finish to end the current activity 2. What is your call finish? Collapse? Still no results, Not collapse, end of normal, but not the current activity, but the entire program?? CodePudding user response:
refer to the eighth floor color gourd Eva response: do all interface program crash looks out of the, the finfish can cancel normal jump it I tried, I set up a time to jump, when finish execution, the whole program exit directly, then I changed onDestroy CodePudding user response:
references 9 f wrryib response: Quote: refer to 7th floor gxh_apologize response: 1. The call can finish to end the current activity 2. What is your call finish? Collapse? Still no results, Not collapse, end of normal, but not the current activity, but the whole program? 1. In ActivityB lay a log, look to whether start, 2. To finish the line commented out and not commented out try CodePudding user response:
Launched, because is the first finish after the jump, jump over it after AvtivityA perform finish, A and B are closed CodePudding user response:
You declare in the Manifest, B... ? CodePudding user response:
refer to the second floor wrryib response: Quote: reference 1/f, fei, higher response: paste have a look at your code Public class ActivityA extends the Activity { Public void onCreate (Bundle savedInstanceState) { Super. OnCreate (savedInstanceState); The setContentView (R.l ayout. Adaptive); StartActivity (new Intent (ActivityA. This, ActivityB. Class); ActivityA. This. Finish (); } } In this way, after the jump was killed the entire program, and then I put the finish () into onDestory (), and then success, Entrance to the activity cannot use finish () to put an end to himself? This will kill the process? I am a little stupid, I were written as before, should be finish in onCreate there, may be where setting of the problem CodePudding user response:
You try, the new start to see a child thread CodePudding user response:
1. Are you in b also wrote finish method, try in b finish make a breakpoint 2. Package abnormal, captured all didn't you realize that, and then take a closer look at log You can test like this: 1. The first to jump to b, delay a finish see again after 2 seconds 2. The finish first, delay for 2 seconds after the jump to see