You can hide the softkeyboard with this code
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Get an instance of your EditText
EditText editText = (EditText) findViewById(R.id.edittext);
To prevent the Default SoftKeyboard from appear in the EditText, override the following events
// Make the custom keyboard appear
edittext.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) showCustomKeyboard(v);
else hideCustomKeyboard();
}
});
edittext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showCustomKeyboard(v);
}
});
edittext.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
EditText edittext = (EditText) v;
int inType = edittext.getInputType(); // Backup the input type
edittext.setInputType(InputType.TYPE_NULL); // Disable standard keyboard
edittext.onTouchEvent(event); // Call native handler
edittext.setInputType(inType); // Restore input type
return true; // Consume touch event
}
});
}
public void hideCustomKeyboard() {
keyboardView.setVisibility(View.GONE);
keyboardView.setEnabled(false);
}
public void showCustomKeyboard( View v) {
keyboardView.setVisibility(View.VISIBLE);
keyboardView.setEnabled(true);
if( v!=null ){
((InputMethodManager)getSystemService(Activity.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
public boolean isCustomKeyboardVisible() {
return keyboardView.getVisibility() == View.VISIBLE;
}
@Override public void onBackPressed() {
if( isCustomKeyboardVisible() ) hideCustomKeyboard(); else this.finish();
}
Disclaimer:- I have implemented custom keyboard in my app and I wrote this tutorial - http://inducesmile.com/android/how-to-create-an-android-custom-keyboard-application/