Changing installed keyboard via clicking edittext through device adminstation
Here the get list of keyboard installed name and package name. so need to change keyboard for different edittext.
InputMethodManager imeManager = (InputMethodManager)getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
List<InputMethodInfo> InputMethods = imeManager.getEnabledInputMethodList();
How to change installed keyboard via clicking edittext through device adminstation
The device administration APIs do not allow you to change the user's chosen input method editor.
Related
Is there any way that we can switch installed keyboards programmatically (without going to the settings section manually)?
My requirement is that the user is presented with all the keyboards which are installed on the phone and gets a chooser dialog to switch to the one wishes?
(basically we want to cut down the step to transfer him to the settings page)
This piece of code will fulfill your requirements:
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
imeManager.showInputMethodPicker();
As Commonsware points out in his answer, there is no way to do this behind the user's back.
If your app has system privileges, and has the permission
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
you can programatically enable the keyboard and set it as the current keyboard by making it the default keyboard WITHOUT USER KNOWLEDGE OR INTERVENTION!
//get the old default keyboard in case you want to use it later, or keep it enabled
String oldDefaultKeyboard = Settings.Secure.getString(resolver, Setting.Secure.DEFAULT_INPUT_METHOD);
//enable your keyboard
Settings.Secure.putString(resolver, Settings.Secure.ENABLED_INPUT_METHODS, "com.my.keyboard/.full.path");
//set your keyboard as the new default keyboard
Settings.Secure.putString(resolver, Settings.Secure.DEFAULT_INPUT_METHOD, "com.my.keyboard/.full.path");
You can enable multiple keyboards (such as the default keyboard and your own) by providing a list of keyboards to the ENABLED_INPUT_METHODS, separated by ':'. See docs
You can verify your keyboard's full package and path ID by invoking ime list -a through adb shell
If you have rooted device, you can use /system/bin/ime utility.
List all installed input methods: # ime list -a
Set google's keyboard as default:
# ime set com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
On Java side use Runtime.getRuntime().exec(...).
Is there any way that we can switch installed keyboards programmatically (without going to the settings section)?
Fortunately, no, for security reasons. If an app could dictate what input method editor is used, malware would change the input method editor to their keylogger.
import android.content.Intent;
import android.view.inputmethod.InputMethodManager;
// To enable keyboard
startActivity(new Intent("android.settings.INPUT_METHOD_SETTINGS"));
// To activate the keyboard
InputMethodManager imeManager = (InputMethodManager)
getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
imeManager.showInputMethodPicker();
i want to detect whether Arabic keyboard is installed in device or not. how it is possible. i want to check if Arabic keyboard is available other wise give link to install it first.
InputMethodManager manager = (InputMethodManager)getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
List InputMethods = manager.getInputMethodList();
This will give list of input method in device.
-check for Arabic keyboard packagename/.classname
I'm writing an app for Android using LibGDX. When the user enters a text field the soft keyboard shows up, but the shift key is not pressed; moreover, after the user inserts a period, the shift key doesn't toggle automatically. Does anybody know how to turn on the automatic capitalization?
Thanks
Additional info
The LibGDX backend for Android opens the keyboard using the following code:
InputMethodManager manager = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
View view = ((AndroidGraphics)app.getGraphics()).getView();
view.setFocusable(true);
view.setFocusableInTouchMode(true);
manager.showSoftInput(((AndroidGraphics)app.getGraphics()).getView(), 0);
I don't need to do everything through the frontend, I'm able to add custom code into the Android backend.
Is there any way that we can switch installed keyboards programmatically (without going to the settings section manually)?
My requirement is that the user is presented with all the keyboards which are installed on the phone and gets a chooser dialog to switch to the one wishes?
(basically we want to cut down the step to transfer him to the settings page)
This piece of code will fulfill your requirements:
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
imeManager.showInputMethodPicker();
As Commonsware points out in his answer, there is no way to do this behind the user's back.
If your app has system privileges, and has the permission
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
you can programatically enable the keyboard and set it as the current keyboard by making it the default keyboard WITHOUT USER KNOWLEDGE OR INTERVENTION!
//get the old default keyboard in case you want to use it later, or keep it enabled
String oldDefaultKeyboard = Settings.Secure.getString(resolver, Setting.Secure.DEFAULT_INPUT_METHOD);
//enable your keyboard
Settings.Secure.putString(resolver, Settings.Secure.ENABLED_INPUT_METHODS, "com.my.keyboard/.full.path");
//set your keyboard as the new default keyboard
Settings.Secure.putString(resolver, Settings.Secure.DEFAULT_INPUT_METHOD, "com.my.keyboard/.full.path");
You can enable multiple keyboards (such as the default keyboard and your own) by providing a list of keyboards to the ENABLED_INPUT_METHODS, separated by ':'. See docs
You can verify your keyboard's full package and path ID by invoking ime list -a through adb shell
If you have rooted device, you can use /system/bin/ime utility.
List all installed input methods: # ime list -a
Set google's keyboard as default:
# ime set com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
On Java side use Runtime.getRuntime().exec(...).
Is there any way that we can switch installed keyboards programmatically (without going to the settings section)?
Fortunately, no, for security reasons. If an app could dictate what input method editor is used, malware would change the input method editor to their keylogger.
import android.content.Intent;
import android.view.inputmethod.InputMethodManager;
// To enable keyboard
startActivity(new Intent("android.settings.INPUT_METHOD_SETTINGS"));
// To activate the keyboard
InputMethodManager imeManager = (InputMethodManager)
getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
imeManager.showInputMethodPicker();
i want to set scandinavian keyboard as default keyboard on an android device and
i want to do this by code.
So i try with InputMethodManager :
InputMethodManager mng = (InputMethodManager)getSystemService(LoginActivity.INPUT_METHOD_SERVICE);
List<InputMethodInfo> m_list=mng.getInputMethodList();
and i find the method setInputMethod (IBinder token, String id) of the InputMethodManager class. But i don't find examples/documentation that explain me how to use it.Any suggestion? Thanks.
Hi everybody, i want to set scandinavian keyboard as default keyboard on an android device and i want to do this by code.
You cannot modify the "default keyboard on an android device" via code from a standard SDK application. The user can choose their own keyboard and locale via the Settings application. You can send users to the proper Settings screen via ACTION_INPUT_METHOD_SETTINGS and ACTION_LOCALE_SETTINGS, which are activity Intent actions defined on android.provider.Settings.
Applications that are part of the device firmware can use DEFAULT_INPUT_METHOD on android.provider.Settings.Secure.