Virtual keyboard – ShiVa Engine

Virtual keyboard

Nav Gupta: “This advanced solution requires Eclipse. We are assuming you know how to do Hooks and Callbacks for Android and also know how to create custom handlers.”

Basic Idea

– Create handler in ShiVa
– Call handler wherever you want android virtual keyboard to show up
– Export via UAT and Create project in Eclipse
– Link up code from C++ to Java
– Write Java code to launch keyboard

ShiVa Steps

– In ShiVa, create a new custom handler called onCallKeyboard
– Call handler wherever you want the android virtual keyboard to show up using the following code:

user.sendEvent ( this.getUser ( ), "MainAI", "onCallKeyboard" )

..then export as STK file. Create an Android PROJECT, build and compile.

Eclipse Steps

Import into Eclipse and set up a project with jni files to be able to do proper hooks and callbacks. Link S3DClient.cpp to YourAppName.java file

Java Code

Add import android.app.Service; to the top of the imports list on line 7. Place the following code in the Java code portion:

InputMethodManager imm = (InputMethodManager) oThis.getSystemService(Service.INPUT_METHOD_SERVICE);
imm.showSoftInput( o3DView, 0 );
return 0;

Compile and Test. If all goes well, you should now have the android virtual keyboard up and running!
PS: I’ve done a few tests and the only bug I am finding thus far (Tested on Kindle Fire) is that the backspace button actually works like a DELETE button instead. It does not remove text BACKWARDS, it actually removes text infront of the cursor (opposite direction). Other than that, the rest of the keys work as they are meant to.




Need more answers?

  • slackBanner