I am developing one small application in android which consist 开发者_JS百科of an Edit Text & Button. Button will be visible only after edit text is not blank.Since I am having LG Optimums Android device, Whenever i click on Edit Text since it it LG device, LG Key Board will appear but i don't want that Key Board i want Android Key Board to use. I Also know that i can go into Setting=>Language & Key Board & i can change that Key Board. But i don't want to use that i want it should be done only through coding.
Thanx for any Help.....
It's not possible to change the keyboard settings for the user programmatically. The only thing you can do is advise the user to change it and help it to do so. For instance, this will show a dialog for them to change keyboard:
private void showInputMethodPicker() {
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
if (imeManager != null) {
imeManager.showInputMethodPicker();
} else {
Toast.makeText(this, R.string.not_possible_im_picker, Toast.LENGTH_LONG).show();
}
}
As far as I've seen, and from an Android employee here, it is simply not possible to change the IME programatically - it is completely dependent on the end-user to choose their preferred IME.
Like Paul said you cannot change the IME; however, you can disable the android softkeyboard by hiding it
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
then create a view that resembles an android softkeyboard. Check this out.
Change the keyboard from your app on Button Click :
Button keyboard = (Button) findViewById(R.id.keyboardChange);
keyboard.setOnClickListener(new View.OnClickListener() {
public void onClick(View view)
{ InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
imeManager.showInputMethodPicker();
}
});
精彩评论