I made a little game touch the screen to move up, release to go down. However, the player can die by colliding with the screen bounds. On collision, a new activity starts. 'Unfortunately the app has stopped' appears when I keep pressing after the collision. Using onTouchEvent
.
What can I do?
I am using Eclipse, and appreciate every answer
Take a look at the code that you execute in response to the onTouch event. Can it execute if the Activity is being destroyed or has already been destroyed , e.g. are you using a background thread or an AsyncTask? You need to respect the Activity lifecycle, otherwise you may be attempting to access an Activity that is no longer in an active state.