Extending AlertDialogs in Android (where to find examples, how to get title and buttons)

前端 未结 3 1985
别跟我提以往
别跟我提以往 2020-12-16 07:18

I have been looking a lot for examples on how to correctly extend AlertDialogs and get the expected behaviour, but I can hardly find any.

The docs on google doesnt r

3条回答
  •  时光说笑
    2020-12-16 07:37

    I got my custom AlertDialog to work using something similiar to this code.

    First make your constructor publicly accessible

    public PausDialog(Context context)
    

    Then you can simply instantiate and show it as so:

    PauseDialog newDialog = new PauseDialog(this);
    newDialog.setTitle("My Dialog");
    newDialog.setButton("OK", ...); // Insert your onClick implementation
    newDialog.setButton2("Cancel", ...); // Insert your onClick implementation
    newDialog.Show();
    

提交回复
热议问题