Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to hide softkeypad provided not effecting the features of the edittext in android

I have hidden soft keypad because I have custom keypad on the app. When the edittext is clicked, soft keypad shouldn't pop up. So, I have tried so many ways from the sources, but nothing worked except the editText.setFocusable(false); . But now the problem is edittext is not getting highlighted when I clicked it and even cursor is not visible. I have tried using InputManager, android:windowSoftInputMode="stateAlwaysHidden in the manifest and referred many like link 1 , link 2 etc., but these techniques atleast don't even hide the soft keypad on my app. Finally I got this through setFocusable, but there is a highlighting problem and cursor invisible problem and even requestFocus() in the onClickListener didn't work. Can someone give exact solution for this problem? Code snippet is appreciated.

like image 534
Enthusiast Avatar asked Sep 08 '12 06:09

Enthusiast


2 Answers

Try this one in activity class

getwindow().setsoftInputMode(winowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

This one is avoiding of soft key pad

like image 114
Kiran Android Avatar answered Sep 20 '22 06:09

Kiran Android


please use this in manifest:

android:configChanges="orientation|keyboardHidden"         
android:windowSoftInputMode="stateHidden" 
like image 33
Ashish Agrawal Avatar answered Sep 22 '22 06:09

Ashish Agrawal