Android – Custom Dialog – Can’t get text from EditText

If you want to inflate a xml file into dialog box for creating custom version you can use the following code which gets two input from user LayoutInflater linf = LayoutInflater.from(this); final View inflator = linf.inflate(R.layout.twoinputs, null); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(“Tilte”); alert.setMessage(“Message”); alert.setView(inflator); final EditText et1 = (EditText) inflator.findViewById(R.id.editText1); final EditText et2 = … Read more

is it possible to create listview inside dialog?

this implementation doesn’t require you to make any xml layouts. it was written as a case statement in “onCreateDialog” override, but you can adapt if for your purposes very easily: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(“Select Color Mode”); ListView modeList = new ListView(this); String[] stringArray = new String[] { “Bright Mode”, “Normal Mode” }; ArrayAdapter<String> … Read more

Change button color in AlertDialog

Here is how I did. AlertDialog.Builder customBuilder = new AlertDialog.Builder(new ContextThemeWrapper(this,android.R.style.Theme_Dialog)); customBuilder.setTitle(R.string.popup_error_title); customBuilder.setNegativeButton(“Exit application”, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { MyActivity.this.finish(); } }); AlertDialog dialog = customBuilder.create(); dialog.show(); Button b = dialog.getButton(DialogInterface.BUTTON_NEGATIVE); if(b != null) { b.setBackgroundDrawable(getResources().getDrawable(R.drawable.my_button)); } I find the drawable here

Apply CSS to jQuery Dialog Buttons

I’m reposting my answer to a similar question because no-one seems to have given it here and it’s much cleaner and neater: Use the alternative buttons property syntax: $dialogDiv.dialog({ autoOpen: false, modal: true, width: 600, resizable: false, buttons: [ { text: “Cancel”, “class”: ‘cancelButtonClass’, click: function() { // Cancel code here } }, { text: … Read more

Android simple alert dialog [duplicate]

You would simply need to do this in your onClick: AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create(); alertDialog.setTitle(“Alert”); alertDialog.setMessage(“Alert message to be shown”); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, “OK”, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); I don’t know from where you saw that you need DialogFragment for simply showing an alert.

AlertDialog without context in Flutter

Solution without third-party libraries or storing BuildContext: final navigatorKey = GlobalKey<NavigatorState>(); void main() => runApp( MaterialApp( home: HomePage(), navigatorKey: navigatorKey, // Setting a global key for navigator ), ); class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(), body: SafeArea( child: Center( child: Text(‘test’) ) ), floatingActionButton: FloatingActionButton( onPressed: showMyDialog, … Read more