jueshi / apwidgets

Automatically exported from code.google.com/p/apwidgets
0 stars 0 forks source link

How to hide the soft keyboard for the APEditText widget? #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
As in the given example, I am not using XML to handle the layout, as in 
conventional Android java methodology.  All the examples that I've found 
require a window token to be obtained in order to hide the soft keyboard.  

I'm able to use the hide() method to hide the widget container, but that 
doesn't hide the soft keyboard that's associated with the widgets in that 
container.

I'm using the r44 june version for java 1.5.

Original issue reported on code.google.com by noisefac...@gmail.com on 26 Aug 2011 at 5:04

GoogleCodeExporter commented 9 years ago
I figured it out myself.

InputMethodManager mgr = (InputMethodManager) 
getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(textField.getView().getWindowToken(), 0);

Original comment by noisefac...@gmail.com on 26 Aug 2011 at 5:23

GoogleCodeExporter commented 9 years ago
You can also do this:
textField.setInputType(0);

Original comment by nima.leg...@gmail.com on 7 Nov 2011 at 4:11