在Android中获取用户输入的最快方式

Vin*_*ent 4 user-interface android

创建用户输入对话框的最快方法是什么?每次我需要用户输入看起来像我的情况下看起来有点过分,我可以做不同的活动.我只需要在不同的屏幕上为用户界面添加少量弹出窗口.

有人能指出我正确的方向吗?

whi*_*win 14

来自API的AlertDialog.Builder.这是一个例子:

AlertDialog.Builder alert = new AlertDialog.Builder(this);

alert.setTitle("Title");
alert.setMessage("Message");

// Set an EditText view to get user input 
final EditText input = new EditText(this);
alert.setView(input);

alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
  String value = input.getText().toString();
  // Do something with value!
  }
});

alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface dialog, int whichButton) {
    // Canceled.
  }
});

alert.show();
Run Code Online (Sandbox Code Playgroud)

这是检索用户输入的便捷方式.

http://www.androidsnippets.com/prompt-user-input-with-an-alertdialog