Skip to content

Instantly share code, notes, and snippets.

@sidward35
Last active July 20, 2017 04:44
Show Gist options
  • Save sidward35/d6934cb5d1f76ad5a243b28552c1b56b to your computer and use it in GitHub Desktop.
Save sidward35/d6934cb5d1f76ad5a243b28552c1b56b to your computer and use it in GitHub Desktop.
Android AlertDialog with EditText
final EditText input = new EditText(MainActivity.this);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
input.setLayoutParams(lp);
new AlertDialog.Builder(MainActivity.this)
.setTitle("New Playlist")
.setPositiveButton("Create", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.setIcon(R.drawable.new_playlist)
.setView(input)
.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment