I am developing an Android game and I have my SurfaceView rendering the game and I want to make it so when the player loses or wins an AlertDialog pops up and either restarts the level or whatever.
Basically I have two questions:
-
How do I use AlertDialogs with SurfaceViews? Do I have to put it into the layout.xml or does it get coded into the UI part or the game thread part?
-
Is there a way to “restart” an activity so it doesn’t make a new one just starts the current one over with the same “intent” it was given originally?
Thank You!
You can use
this.Start();on any event to restart the thread in your activity that’s the answer of your second question.Or you can use