Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android app specific soft keyboard

Is there a way to create an app specific soft keyboard on Android? After reading about InputMethodService docs and checking out alternative keyboard apps out there, I figure the alternate keyboard can only be configured for system wide usage (through Settings -> Locale and Text).

If the answer to above question is no, then is there at least a way to load a custom dictionary and override the default dictionary of the system keyboard (only when my app is in use)? That will help in giving very relevant suggestions to the user when he has only tapped couple of keys.

like image 310
Jayesh Avatar asked Dec 13 '09 16:12

Jayesh


People also ask

Can you have different keyboards for different apps?

Android allows you to download additional 3rd party keyboards (not just other languages, but also alternate layouts and typing methods). In addition to getting the keyboard, you have to “activate” it in your Settings under System -> Languages and Inputs -> Virtual Keyboards.

How do I change the soft keyboard on my Android?

What to Know. Go to Settings > System > Languages & input. Tap Virtual keyboard and choose your keyboard. You can switch between keyboards by selecting the keyboard icon at the bottom of most keyboard apps.

What is soft keyboard in Android?

A soft keyboard (sometimes called an onscreen keyboard or software keyboard ) is a system that replaces the hardware keyboard on a computing device with an on-screen image map .


2 Answers

If you just want a View that looks and acts like a soft keyboard, I did that in my SmallKeyboard class. You just need to extend android.inputmethodservice.KeyboardView and decide on layout. See the onKey and onText methods at the end of that file for the action taken when keys are pressed.

Instead of my keyboard model inner class, you could load it from XML if your key set is fairly constant.

like image 158
Chris Boyle Avatar answered Oct 09 '22 22:10

Chris Boyle


The Android Nethack application has a complete and clear source code example of how to create a custom keyboard for an application, how to display it on screen and how to define multiple keyboard layouts. It contains pretty much everything you need to know.

It is by far the best example I have seen.

http://code.google.com/p/nethack-android/

like image 30
Torben Avatar answered Oct 09 '22 20:10

Torben