Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Keyboard on Button click in android?

How can I open Keyboard on Button click in android?

What I want to be like this:

enter image description here

like image 695
Girish Patel Avatar asked Nov 10 '11 10:11

Girish Patel


2 Answers

Please try this

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
like image 105
Sandy Avatar answered Sep 30 '22 06:09

Sandy


InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);

imm.showSoftInput(view, flags)

an example may be:

InputMethodManager imm = (InputMethodManager) RouteMapActivity.this
    .getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mapView, InputMethodManager.SHOW_IMPLICIT);
like image 25
drooooooid Avatar answered Sep 30 '22 07:09

drooooooid