Suppose the game is drawn on the canvas, if I lose, I want to display a window with the result and the button to continue, what are the options? Print a separate fragment? Is it possible? Or is it a new activation that is designed so that it looks like a window? It seems there is still a dialog box, but is it possible to impose it to any kind and display it over the canvas?

public class MainGamePanel extends SurfaceView implements SurfaceHolder.Callback { //тут создается поток в котором реализован игровой цикл, при некотором положении в игровом цикле хочу вызвать диалог, но так как наследуюсь не от Activity сделать это не получается.. как быть? } 

So I call the dialogue

 new GameOverFragment().show(getFragmentManager(),"login"); 

The problem is exactly the same as here https://stackoverflow.com/questions/10268422/show-dialog-in-game-with-canvas but I did not understand how they solved it ..

    1 answer 1

    Canvas is located in a particular place of the interface and does not affect the rest of the interface. You can show the dialog in any convenient way: a dialog box , a new fragment, or make visible an already existing interface element located on top.

    • I realized that for me it is now important to make this window, for example, round, with its own background, with its form of buttons. What is used to lead to this type of interface? DialogFragment with its markup? - Turalllb
    • one
      Everything round is actually square with a transparent background in the corners. :) you can show a picture with the image of your round interface, and handle the touch via using onTouchEvent (). You can make your own class with round buttons (hint: the button is a TextView with an added background, you can make your own). - tse
    • I can't even show the dialogue over the canvas ... I can't call it. I will now attach the class code from which I want to call it. - Turalllb