Skip to content

Instantly share code, notes, and snippets.

@VAlux
Last active January 1, 2016 06:39
Show Gist options
  • Save VAlux/8106276 to your computer and use it in GitHub Desktop.
Save VAlux/8106276 to your computer and use it in GitHub Desktop.
Android prompt dialog using alert builder
final EditText txt = new EditText(this);
new AlertDialog.Builder(this)
.setTitle("Title")
.setView(txt)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String url = txtUrl.getText().toString();
//do smth. with it.
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
})
.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment