1

I want to make an application to automatically change my mobile keyboard according to application. My mobile default keyboard will change according to application, such as:

I want to use "Ridmik Keyboard" with Facebook or want to use "Swift keyboard" with Google play. Is it possible ?

Raptor
  • 53,206
  • 45
  • 230
  • 366
TKumar
  • 818
  • 2
  • 10
  • 35

2 Answers2

2

I'm pretty sure that it's not possible. The only way you can change the keyboard is by asking the user to do so from the device's settings. Automatically changing the keyboard would be a major security hole, as a malicious keyboard could track passwords, for example. Alternatively, you could ask the user to select a keyboard by calling startActivity(new Intent(android.provider.Settings.ACTION_INPUT_METHOD_SETTINGS));, and you can detect when a certain application is launched by sniffing into the LogCat.

Eduard B.
  • 6,735
  • 4
  • 27
  • 38
  • Sir, Thanks for your response. That code you mentioned above shows the List of input method. But I need Choosing option beside the keyboard list. And how can I show keyboard choosing option with each application open ? – TKumar Jan 06 '14 at 08:50
  • You are right. You can use the following snippet: `InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showInputMethodPicker();` – Eduard B. Jan 06 '14 at 10:57
  • Yes, I got it. But now I want to show this InputMethodPicker with every times ,when my handset open an application and click any EditText.Is it Possible ? – TKumar Jan 06 '14 at 11:01
  • As I said, for detecting when an application is launched you could scan the LogCat for specific events. You can find more info here: [link](http://stackoverflow.com/questions/11346557/how-to-detect-when-the-user-launches-another-app-android) Other potential solutions could be continuously poll the ActivityManager for running tasks, or using Accessibility service and listen for window changed events: [link](http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html) – Eduard B. Jan 06 '14 at 11:25
  • Technically, when the user clicks an EditText, the keyboard shows up, so by continuously polling the keyboard's state, you could detect this event. Some potential implementation can be found here: [link](http://www.ninthavenue.com.au/how-to-check-if-the-software-keyboard-is-shown-in-android) Anyhow, this solutions is pretty hacky, and may not work always. – Eduard B. Jan 06 '14 at 11:26
0

If you are willing to root your device there are at least two solutions in the Google Play store that claim to do what you want: Keyboard Manager and Keyboard Master.

For non-rooted devices, there is Keyboard Manager Plus - however you should be aware that it flashes the keyboard picker on the screen as it automatically changes the keyboard. If you can live with that, that's a possible solution for you without rooting.

Caveat: I have not tried these myself. I am researching the issue and I do not have the option of rooting the device and I cannot live with the flashing. However, I've taken a pretty close look at all three of the above and they are the closest I've found to answering your question.

yosh m
  • 183
  • 1
  • 3