android-alertdialog
Android 5.x: Why does Dialog.Builder cuts text off?
Have you tried using Dialog instead? final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.custom); dialog.setTitle(“Title…”); // set the custom dialog components – text, image and button TextView text = (TextView) dialog.findViewById(R.id.text); text.setText(“Android custom dialog example!”); // make 3 buttons instead of one Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); // if button is clicked, close the custom dialog … Read more
How to use Dialog Fragment? (showDialog deprecated) Android
You can show your DialogFragment like this: void showDialog() { DialogFragment newFragment = MyAlertDialogFragment.newInstance( R.string.alert_dialog_two_buttons_title); newFragment.show(getFragmentManager(), “dialog”); } In you fragment dialog you should override onCreateDialog and return you instance of simple Dialog, for example AlertDialog. public static class MyAlertDialogFragment extends DialogFragment { public static MyAlertDialogFragment newInstance(int title) { MyAlertDialogFragment frag = new MyAlertDialogFragment(); Bundle … Read more
Displaying soft keyboard whenever AlertDialog.Builder object is opened
As long as you always need to show the keyboard immediately once the dialog opens rather than once a specific form widget inside gets focus (for instance, if your dialog just shows an EditText and a button), you can do the following: AlertDialog alertToShow = alert.create(); alertToShow.getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); alertToShow.show(); Rather than calling .show() on your … Read more