I am playing an animation by using runnable thread inside a surface view. When I run the application for the first time, everything works fine and animation plays properly. When I press back/home button and reopens the application, I am getting a Black Screen with no animations but the runnable thread works on the background which I confirmed using Log cat entry.
Also, I am overriding the back button press event and finish() is called inside the back button press event.
Can any one please help me out why surfacecreated method is not being called when I resume the application?
Note : When I use
android.os.Process.killProcess(android.os.Process.myPid());
Inside the back button event instead of finish() method, the application works properly in onresume event.
Thanks in Advance, Tim
I think,you must extend SurfaceView class and listen on surfaceChanged method。And in the method to draw again.
code:
Hope this can help you.