Skip to content

Instantly share code, notes, and snippets.

@bjorn-ali-goransson
Created April 24, 2014 20:51
Show Gist options
  • Save bjorn-ali-goransson/11269076 to your computer and use it in GitHub Desktop.
Save bjorn-ali-goransson/11269076 to your computer and use it in GitHub Desktop.
Get Text String from User via Dialog in Android
final EditText input = new EditText(this);
new AlertDialog.Builder(this)
.setTitle("Title")
.setMessage("Message")
.setView(input)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
ip = input.getText().toString();
}
})
.create()
.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment