Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You seem to have trouble with some basic Android behaviour.</p> <p>First of all, when the user presses the HOME button, he isn't <strong>exiting your application</strong>, he is just putting your application in the background so that he can go do something else. He doesn't expect your application to exit if he does this. In fact, when he returns to your application he expects to find it in exactly the same condition as when he left it. This is standard Android behaviour and you shouldn't change that unless you have a really good reason to.</p> <p>Secondly, when the user presses the BACK button, Android automatically finishes the current activity and returns to the previous activity in the activity stack. This is standard Android behaviour and you don't need to write anything special to make this happen.</p> <p>From looking at your code you have activity <code>TunnelsActivity</code> that starts activity <code>Cgt</code>. <code>TunnelsActivity</code> does not call <code>finish()</code> when it starts <code>Cgt</code> so the activity stack will have <code>TunnelsActivity</code> on the bottom and then <code>Cgt</code> on the top when that activity is running. in <code>Cgt</code> you are catching the BACK button and the HOME button and calling <code>onStop()</code>. This is definitely wrong. You should never call <code>onStop()</code>. <code>onStop()</code> is called by Android as part of the Activity lifecycle in certain situations. Calling <code>onStop()</code> will not make your activity go away nor will it make your application exit. All it will do is confuse Android. Also, when Android calls <code>onStop()</code> it expects the code to call through to <code>super.onStop()</code> which your code isn't doing. This will cause the code to throw an Exception, which may be why you are seeing your activities getting restarted.</p> <p>I suggest removing your <code>onStop()</code> method and removing your <code>onKeyDown()</code> method. That may solve all your problems.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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