Skip to content

Instantly share code, notes, and snippets.

@sandeepyohans
Last active September 23, 2019 07:30
Show Gist options
  • Save sandeepyohans/32f1c83eaaac253f26acd2a5566ec39f to your computer and use it in GitHub Desktop.
Save sandeepyohans/32f1c83eaaac253f26acd2a5566ec39f to your computer and use it in GitHub Desktop.
Add Custom Layout to AlertDialog Android
public void showCustomAlert() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.update_layout, null);
dialogBuilder.setView(dialogView);
EditText etName = (EditText) dialogView.findViewById(R.id.etName);
AlertDialog alertDialog = dialogBuilder.create();
alertDialog.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment