[Solved] App shut down when open the 4th time [closed]


OK,

the code is very dirty, first of all i must say it’s so hard to read it.

Your problem is your activity implementing a runnable and even if you close your application that runnable never stops. So it accumlates on VM, thats why after a while you are getting crashed and VM getting restarted, that’s why when you enter the 4rd time it comes OK.

Try to change your p_running variables to false onDestroy event. I mean override onDestroy like below:

@Override
protected void onDestroy(){
     p_running=false;
}

But that does not guarentee your code will work on 4rd times. Because VM does not understand your code should clean up immediatly. Thread won’t stop a while. So you can try to stop Thread hardly but it’s not a proper way.. So try to change your code another way..

0

solved App shut down when open the 4th time [closed]