java - Show Soft Keyboard when EditText Appears -


i have code in android app, alert dialog , keyboard, , when dialog shown want keyboard appear. not , not sure why?

here code:

final alertdialog.builder alert = new alertdialog.builder(this);      alert.settitle("title");     alert.setmessage("message");      final edittext input = new edittext(this);     input.setinputtype(inputtype.type_class_number);     alert.setview(input);      input.setonfocuschangelistener(new view.onfocuschangelistener() {         @override         public void onfocuschange(view v, boolean hasfocus) {             if (hasfocus) {                 log.i(tag, "in focus");                 inputmethodmanager inputmethodmanager = (inputmethodmanager) getsystemservice(context.input_method_service);                 inputmethodmanager.showsoftinput(input, inputmethodmanager.show_implicit);             }         }     }); 

but keyboard not appear though edit text in focus, , tell appear why, doesn't come up?

thanks in advance.

i tested code , keyboard opened when alert.show() executed. if using emulator sure have virtual keyboard enabled. otherwise keyboard never appear on device screen.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -