5. Android (Java)

Although I think app programming is going to go out of fashion and be replaced by HTML5 (see my tutorial), I do think Android will become even more important and creating basic features of it like its keyboard will therefore be important.

For this reason, here’s a tutorial about making Android keyboards.

1. Download and install Android Studio

First download and install Android Studio, the main thing (IDE) for prorgramming Android apps in.

2. Make project and copy files

Open Android Studio and choose Start a new Android Studio project. I called mine Bubbles and my company website is sickschool.com. This means the first line in all my Java code becomes

Your first line will be different.

When setting up project, just stick the with defaults.

Now add some files. Expand app node for the project (see image below) until you see your java files. Right click the top node in the list (mine says com.sickchool.bubbles) and a new Java Class.

right-click-to-add-java

Name the new Java Class MyKeyboard. Keep other defaults. Replace the code you get, except for the first line, with the code below (so that means, keep your first line and don’t copy my first line, the bit that begins with “package…”).

MyKeyboard.java

Then add another Java Class. Name it MyView. Replace the code with code below (again, don’t replace you first line).

MyView.java

Now, under the app node of the project you clicked before, there is manifests node (see image below). Open it and you’ll find AndroidManifest.xml. Double click it and it’ll open up on the right.

open-manifest

In AndroidManifest.xml, copy the bit of my code that begins and ends the service tags

AndroidManifest.xml

Next, right click res folder under the app node and create a new directory. Call the new directory xml so that you now have a new folder and file like the image below.

create-method-xml

Replace the code you get with my code below.

method.xml

 

3. Setup your phone to get app you’ve just created

Choose Setup > Developer options the scroll down and check the USB debugging option. Your phone might not have the developer options in the same place as mine, you might have to Google it.

Connect your phone to your computer by USB.

 

4. Install app on  your phone

Click the green play button to run your app on your phone (see image below).

run-app

Choose the default options that follow. It might take a minutes to do stuff with your code (compile it) and a blank app will pop up on your phone.

Exit the app and go to Settings > Language and input. Your new keyboard is called Bossboard. Select it as the default keyboard.

Now go to any app that requires typing and Bossboard will pop up when you click a text box. The keyboad is just a little white rectangle with and black circle on it. Tap anywhere on this very basic keyboard and you will type “a”.

I’ve put some basic code in the program so that you can easily extend it.

Extended example 1: Zoom type

Here’s an example showing how the above example can be extended. In this keyboard the keys go towards your finger as your finger goes towards that key. The point is to overcome the problem in current keyboards that have very tiny keys.

 

Extended example 2: Swipe type

Swipe the keys to type in this example. The code is set so you must pause over a key for 1 second for it to register as a key press.