Girish Patel
Girish Patel

Reputation: 1275

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

Upvotes: 9

Views: 26378

Answers (3)

Sandeep Kumar P K
Sandeep Kumar P K

Reputation: 7482

Please try this

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

Upvotes: 34

Paresh Mayani
Paresh Mayani

Reputation: 128428

Write this code inside the Button click event to TOGGLE the keyboard:

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

Upvotes: 3

drooooooid
drooooooid

Reputation: 1584

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);

Upvotes: 10

Related Questions