Right now Im calling a new activity with an xml-view when I pause my game, but Since I do this I need to use context in my real-time code, and this is causing a memory leak. Is there any preffered way to pause the game? By pause I mean if game is over, if I die, or if I press pause-button. Would a custom dialog work just aswell? this would mean I wont have to leave my main-activity while im in-game.
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
|
||||
|
|
|
You can use startActivityForResult, that works fine and it does not need passing the context. But in my games I've created a game object which looks like and behaves like a dialog and simply activate it on pause or game over, thus never create other activity or Android dialog. EDIT An example using Options, which some say is safer in order to avoid out of memory errors:
|
|||||||||||
|