I am using ListViewAdapter for binding ListView on my home page, and a custom keyboard. But when I clicked on EditText, the default keyboard displays.
I tried to hide it by using the following code:
InputMethodManager mgr = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(diesel.getWindowToken(), 0);
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
But it didn't work.
How can I hide the default keyboard from ListViewAdapter?
Android windowSoftInputMode – Resize the application for the soft-keyboard. Posted on October 25, 2010 by Lars Vogel. Android has the so-called Input Method Framework to support different input methods, e.g. keyboard, soft-keyboard, handwriting etc.
Adapter is not the right place to do any UI related activities.
If you want to hide the keyboard on events like click of button, use this
public void onClick(View v)
{
InputMethodManager imm = (InputMethodManager) v.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
Finally i got it. i solved this problem. just added below line in ListViewAdapter.
(EditTextName).setInputType(0);
Now it will not open Default Keyboard on EditText Click or Touch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With