Reputation: 292
I want to change the keyboard language programatically when user selects EditText
field.
i.e.: When user clicks on EditText
, by default English language keyboard pops up.
But I want the Arabic keyboard to open by default...
Upvotes: 2
Views: 1462
Reputation: 2349
You can probably use EditorInfo hintLocales: https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#hintLocales
From https://issuetracker.google.com/issues/79549909
Upvotes: 0
Reputation: 4713
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();
}
}
Upvotes: 3