Dialog with native layout in android

I have a screen on which I have buttons. I would like to know how I can do something like this: when I press the button of a button, I show me a dialog with my interface, where I can write text in two editing blocks, and in this dialog I would like to have one button. Is it possible to execute a dialog with my own interface?

0
android android-layout
source share
1 answer

yes, you can really inflate the layout and create it in the notification dialog

LayoutInflater factory = LayoutInflater.from(this); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); return new AlertDialog.Builder(AlertDialogSamples.this) .setIcon(R.drawable.alert_dialog_icon) .setTitle(R.string.alert_dialog_text_entry) .setView(textEntryView) .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked OK so do some stuff */ } }) .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked cancel so do some stuff */ } }) .create(); 

this is from the sample code provided in the api samples

+2
source share

All Articles