Android AlertDialog Single Button

后端 未结 9 1705
陌清茗
陌清茗 2020-12-12 12:08

I\'d like to have an AlertDialog builder that only has one button that says OK or Done or something, instead of the default yes and no. Can that be done with the standard Al

9条回答
  •  醉话见心
    2020-12-12 12:17

    Its very simple

    new AlertDialog.Builder(this).setView(input).setPositiveButton("ENTER",            
                            new DialogInterface.OnClickListener()                      
                            {   public void onClick(DialogInterface di,int id)     
                                {
                                    output.setText(input.getText().toString());
                                }
                            }
                         )
            .create().show();
    

    In case you wish to read the full program see here: Program to take input from user using dialog and output to screen

提交回复
热议问题