A colleague of mine recently had a problem in an AIR application where the styles got all messed up when a user had SWIFT KEY installed. Seeing as it’s a hugely popular app on the Google Play Store it wasn’t something she could just ignore. The problem is that AIR doesn’t give you a way to detect or change the keyboard, and after 2 weeks of searching she’d given up on trying to find a native¬†implementation.

It turns out this is a relatively trivial thing to do in native java. By getting the INPUT_METHOD_SERVICE we can use the InputMethodManager class to determine what keyboard is currently being used, for example:

private String getKeyboardType(){
InputMethodManager imm = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
List mInputMethodProperties = imm.getEnabledInputMethodList();
final int n = mInputMethodProperties.size();
for (int i = 0; i < n; i++) {
InputMethodInfo imeInfo = mInputMethodProperties.get(i);
if (imeInfo.getId().equals(Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD))) {
return imeInfo.getId();
return "";

The above method returns the current keyboard string definition. In the case of my colleague’s problem, parsing that string for the word “swiftkey” allowed her to determine if swift key was being used as the current keyboard.

While Android prevents you from switching the keyboard programatically, it does give you a way to launch the keyboard switcher. This is the built in dialog used in the setting app to set the keyboard. You don’t need to go to settings, you can just launch it from your app.

private boolean showInputMethodPicker() {
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
if (imeManager != null) {
return true;
return false;

Hope this saves you some time.