-1

I need to disable soft keyboard, and enable only hard one, so I created this kind of edittext, It works really good, but on some htc phones this type of edittext disabling multiline statement(don't know how it works).

public class NoImeEditText extends EditText {
    public NoImeEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    @Override
    public boolean onCheckIsTextEditor() {
        return false;
    }
}

another way I using this kind of code and it doesn't work.

    keyboardText.setShowSoftInputOnFocus(false);


    InputMethodManager imm = (InputMethodManager)getMainActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null)
        imm.hideSoftInputFromWindow(keyboardText.getWindowToken(), 0); 
Phantômaxx
  • 36,442
  • 21
  • 78
  • 108
Nivi dimka
  • 75
  • 8

1 Answers1

1

This might works,

   @Override
    protected void onCreate(Bundle savedInstanceState) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}

This will hide soft keyboard.

Dhruv
  • 1,459
  • 1
  • 18
  • 25