[Java] Android通过警告对话框提示用户输入信息 →→→→→进入此内容的聊天室

来自 , 2021-03-23, 写在 Java, 查看 135 次.
URL http://www.code666.cn/view/5d151d10
  1. AlertDialog.Builder alert = new AlertDialog.Builder(this);
  2.  
  3. alert.setTitle("Title");
  4. alert.setMessage("Message");
  5.  
  6. // Set an EditText view to get user input
  7. final EditText input = new EditText(this);
  8. alert.setView(input);
  9.  
  10. alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  11. public void onClick(DialogInterface dialog, int whichButton) {
  12.   String value = input.getText();
  13.   // Do something with value!
  14.   }
  15. });
  16.  
  17. alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  18.   public void onClick(DialogInterface dialog, int whichButton) {
  19.     // Canceled.
  20.   }
  21. });
  22.  
  23. alert.show();
  24. // see http://androidsnippets.com/prompt-user-input-with-an-alertdialog
  25. //java/8470

回复 "Android通过警告对话框提示用户输入信息"

这儿你可以回复上面这条便签

captcha