Screen triggers Keyboard which is null on android

Hi @t0neg0d:

I’m trying to use the tonegod gui virtual joystick, and as updates come and go, I think it got broken. Below you can see the error I get. I know what is exactly is the problem by the way, so you can ask me anything.

D/dalvikvm(10192): WAIT_FOR_CONCURRENT_GC blocked 20ms
W/dalvikvm(10192): threadid=11: thread exiting with uncaught exception (group=0x41883ba8)
E/com.jme3.app.AndroidHarness(10192): SEVERE Exception thrown in Thread[GLThread 4218,5,main]
E/com.jme3.app.AndroidHarness(10192): java.lang.NullPointerException
E/com.jme3.app.AndroidHarness(10192): at tonegod.gui.controls.extras.android.Keyboard.<init>(Keyboard.java:86)
E/com.jme3.app.AndroidHarness(10192): at tonegod.gui.controls.extras.android.Keyboard.<init>(Keyboard.java:45)
E/com.jme3.app.AndroidHarness(10192): at tonegod.gui.core.Screen.initVirtualKeys(Screen.java:2709)
E/com.jme3.app.AndroidHarness(10192): at tonegod.gui.core.Screen.setSpatial(Screen.java:2177)
E/com.jme3.app.AndroidHarness(10192): at com.jme3.scene.Spatial.addControl(Spatial.java:602)
E/com.jme3.app.AndroidHarness(10192): at co.pixelapp.savetheeggs.SaveTheEggs.initVirtualJoysticks(SaveTheEggs.java:1045)
E/com.jme3.app.AndroidHarness(10192): at co.pixelapp.savetheeggs.SaveTheEggs.simpleInitApp(SaveTheEggs.java:220)
E/com.jme3.app.AndroidHarness(10192): at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
E/com.jme3.app.AndroidHarness(10192): at com.jme3.app.AndroidHarness.initialize(AndroidHarness.java:455)
E/com.jme3.app.AndroidHarness(10192): at com.jme3.system.android.OGLESContext.initInThread(OGLESContext.java:229)
E/com.jme3.app.AndroidHarness(10192): at com.jme3.system.android.OGLESContext.onSurfaceCreated(OGLESContext.java:205)
E/com.jme3.app.AndroidHarness(10192): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1501)
E/com.jme3.app.AndroidHarness(10192): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
E/com.jme3.app.AndroidHarness(10192):

The problem is here in this line:

tonegod.gui.core.Screen.initVirtualKeys(Screen.java:2709)

In order for my program to run without crashing I have to comment out all the lines that have the variable “virtualKeys” in the class tonegod.gui.core.Screen. After that, my program runs like a charm since I don’t intend to use the on-screen keyboard. But this is a bug nonetheless.

I’m testing on a first generation Google Nexus 7 tablet.

These are the two lines I had to comment out:

[java]
//if (isAndroid()) initVirtualKeys();

//if (isAndroid()) virtualKeys.hide(); [/java]

Moreover, this problem doesn’t happen when I run it on my desktop. Everything works fine on my desktop.

I’m pretty good at reporting bugs, hee he.

Eh… this is due to the keyboard being tied to setUseMultitouch … for the time being, set this to true and the keyboard will be created. I’m in the process of updating this to work a little differently.

@t0neg0d I already have [java]screen.setUseMultitouch(true);[/java].

So, that’s not a quick solution.