How do I display an alert dialog on Android?

后端 未结 30 3050
清歌不尽
清歌不尽 2020-11-22 03:02

I want to display a dialog/popup window with a message to the user that shows \"Are you sure you want to delete this entry?\" with one button that says \'Delete\'. When

30条回答
  •  温柔的废话
    2020-11-22 03:35

    for me

    new AlertDialog.Builder(this)
        .setTitle("Closing application")
        .setMessage("Are you sure you want to exit?")
        .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
    
              }
         }).setNegativeButton("No", null).show();
    

提交回复
热议问题