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.

Iv been trying to make a pause menu for an android game iv been working on, it has 2 buttons, resume and exit, the exit button works fine but if you press resume the game continues to run but the dialog wont close, the dialog code is as folows

Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Game Paused !!")
           .setCancelable(false)
           .setPositiveButton("Exit", new DialogInterface.OnClickListener() 
           {
               public void onClick(DialogInterface dialog, int id) 
               {
                    CUBEGameActivity.this.finish();
               }
           })
           .setNegativeButton("Resume", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) 
               {
                   dialog.cancel();
                   CUBEGameActivity.this.onResume();
               }
           });
    AlertDialog dialog = builder.create();
    dialog.show();

Does anyone have any ideas how i could get this to work

share|improve this question

closed as off topic by Joe Wreschnig, Tetrad Jul 25 '12 at 17:31

Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Remove dialog.cancel(); in your second DialogInterface.OnClickListener

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.