I have make my own keyboard, in my activity there is an option (English-Hindi, Hindi-English) when user choose English-Hindi the default keyboard will be open and hide my custom keyboard or when user select Hindi-English option the default keyboard will be hide and custom keyboard will be opened up
below is my source code,
private EditText mEt;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
mEt = (EditText) findViewById(R.id.searchText);
enableHindiKeyboard();
hideDefaultKeyboard();
}
For hiding default keyboard
private void hideDefaultKeyboard() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mEt.getWindowToken(), 0);
}
For enabling Hindi Keyboard
public void enableHindiKeyboard() {
try {
for (int i = 0; i < mB.length; i++)
mB[i].setOnClickListener(this);
mBSpace.setOnClickListener(this);
mBdone.setOnClickListener(this);
mBack.setOnClickListener(this);
mBChange.setOnClickListener(this);
mNum.setOnClickListener(this);
mEt.setOnTouchListener(MainActivity.this);
mEt.setOnFocusChangeListener(MainActivity.this);
mEt.setOnClickListener(MainActivity.this);
} catch (Exception e) {
Log.w(getClass().getName(), e.toString());
}
}
in this problem when i start my activity at that time i want Hindi Keyboard should be display and Default keyboard should be invisible but the problem is that
hindi keyboard will not be shown at startup and Default keyboard will popup