My app currently calls a method in the onCreate()
method so that the game will start and animations will run once the view is created. However when i flip the screen to switch between portrait and landscape, this method is called again.
I've moved the calling line both to the onStart()
method and even the methods class constructor.
this is the method that is being called:
public void startGame() {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
runGame();
}
}, 500);
}
There is a delay to allow everything to be constructed before it is run, otherwise it won't work.
Is there i way to stop onSizeChanged()
affecting this method being called? Or is there a way i can call this method so that it starts when the activity is started (again so that onSizeChanged()
cant affect it and that everything is initialized before its call).
Thanks for looking.
.
stackoverflow.comm
No comments:
Post a Comment