Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Custom Keyboard in Android

Tags:

I'd like to write an custom keyboard which should work on all devices that are running Android 4.0 and up. So first I searched the net but didn't found anything about that. So how can I create an app which replaces the stock keyboard of Android?

What I'd like to know:

  1. Is there a good tutorial out there? Do you guys have sample code?
  2. Do I need root to do this?
  3. What's the structure behind it? (Is it just a regular Activity with a Service??)
  4. Is it possible to read out the Inputbox within the keyboard?
like image 846
safari Avatar asked Jan 11 '13 18:01

safari


1 Answers

So, I did this for about 2 years, when I worked on Swype. You don't need root, you just need to implement an InputMethodService. You can get the text out of most textboxes, but not all (not all edit fields correctly implement their half of the APIs. Particularly anything with an input type INPUT_TYPE_NULL will not work well). To get the text you would call inputConnection.getExtractedText

Be warned- the API is bad, and apps are hit and miss on working with it. A basic keyboard is easy, but try and do anything complex and you'll spend a lot of time. A lot of man hours went in to the big keyboards

like image 134
Gabe Sechan Avatar answered Oct 20 '22 11:10

Gabe Sechan