Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android prevent showing keyboard on dialog.show

Is there a way to prevent the keyboard appear automatically when dialog is showing up.

here is my code for my dialog box

final Dialog dialog = new Dialog(this);
                    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                    dialog.setContentView(R.layout.shopping_cart_confirm_dialog);
                    TextView txtConfirmEmail = (TextView)dialog.findViewById(R.id.txtConfirmEmail);
                    ...
                    dialog.show();

Thanks a lot.

like image 462
Jean-Francois Avatar asked Mar 18 '13 21:03

Jean-Francois


1 Answers

Try this

dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
like image 128
Festus Tamakloe Avatar answered Sep 19 '22 21:09

Festus Tamakloe