I'm developing a game for android with LibGdx. I know that I can implement screens for my game directly using libgdx but I want to implements same activities for the menu screen etc... OK, so... my problem is that i want to back from the game activity to the menu activity by pressing the back button. Thus, I have an activity as menu screen with same widgets like "start game", "score list" and "exit game" right now. When I press "start game", the button launch the main game class and i can play, but when I press back button I want to back to the main menu but it doesn't. It has a similar behaviour but when the menu screen come back and i press "exit game" the game screen restart and the "exit game" doesn't work ! How can i fix that problem ? Is there a method to receive an event from another activity (like back button was pressed)? Thank you guys !
Asked
Active
Viewed 700 times
0
-
have you tried http://stackoverflow.com/questions/7223723/in-libgdx-how-do-i-get-input-from-the-back-button to catch the back button press, then call `finish();` on the activity to "go back" to the previous activity? – EpicPandaForce Oct 27 '14 at 10:07
-
if I add the method to catch the back button, it seems to do nothing. In the android start game activity, I start the libgdx game class and then I tried to implement onBackPress() with finish() and restart main activity but it doesn't work. – Bob91 Oct 27 '14 at 10:54