Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button to show virtual keyboard?

I have a ListView and it is possible to use the hardware keyboard to filter out items. However what should I do for phones that don't have a hardware keyboard and only a virtual one? Is there a way to add a button that when pressed, the virtual keyboard shows up?

like image 964
Tyler Avatar asked Jan 01 '10 20:01

Tyler


2 Answers

I was able to toggle the on-screen keyboard using the code below. I hope this is useful to someone.

InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.toggleSoftInput(0, 0);
like image 101
Mark F Guerra Avatar answered Oct 11 '22 17:10

Mark F Guerra


One suggestion could be to just use a text entry box (EditText). That way a user can in theory type more than one character to narrow the search (and see what they've typed). To display the on-screen keyboard, all they need do is touch in the textbox. If that box was named "Search" or something similar, I believe it would be more intuitive to a user than a button.

like image 32
bdls Avatar answered Oct 11 '22 17:10

bdls