Reputation: 335
I am developing an application where I have RFID reader (emulates keyboard). In some activities I need a virtual keyboard as well. I have discovered that all I need is to toggle "Use Physical Keyboard". That works fine, but when I restart my tablet, this feature is set to default?
Is it possible, if I can insert a toggle somewhere in my code?
Upvotes: 3
Views: 1505
Reputation: 5087
I was able to toggle the on-screen keyboard, with the following code:
InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.toggleSoftInput(0, 0);
In reference, use EditText.
"EditText is a thin veneer over TextView that configures itself to be editable."
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 useful to a user than a button.
Upvotes: 1