Get SoftInput Keyboard Height Android

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Get SoftInput Keyboard Height Android

Post by LunaRebirth »

Hello,
I'm trying to get the height of the Android keyboard that appears on-screen so I can move textboxes up into the screen's view.

Looking through the android_tools.cpp code for setSoftInputVisibility, I see jclass classView = jni->FindClass("android/view/View"); and jmethodID mid_getDecorView = jni->GetMethodID(classWindow, "getDecorView", "()Landroid/view/View;");
which I assume are pieces of something I need to determine the height.

Just wanted to see if anyone knew of a way to get their keyboard height :-)
Thanks
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Get SoftInput Keyboard Height Android

Post by CuteAlien »

Sorry, don't know. But I also couldn't figure out the problem you run into last time with the soft-keyboard failing on newer Android when in landscape mode. I've looked into that a lot, but in the end gave up because like it looks like it's a problem in the Java-code (my guess is that inputmethodservice/SoftInputWindow.java dispatchTouchEvent is running into an invalid bounds-check). And google doesn't officially support mixing native code and their Java SDK. Which means - there isn't really an offiical way to use the Android keyboard with native code. I've decided to go completely with self-coded custom keyboards in the future unless Google starts caring about NDK developers more some day.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Get SoftInput Keyboard Height Android

Post by LunaRebirth »

The strange issue with my keyboard from an earlier post is fine and working again. Google seems to be updating the keyboard, though I can't speak for all Android phone devices.

Hmm okay.
Do you have any recommendations on what I should look online for making a custom keyboard?
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Get SoftInput Keyboard Height Android

Post by CuteAlien »

Well, basically a keyboard is a gui-dialog with a bunch of buttons. Buttons can send key-events to Irrlicht.
That's pretty much it :-) (get's more complicated with international keyboards when you need different layouts...)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Get SoftInput Keyboard Height Android

Post by LunaRebirth »

Ah okay that makes sense.
I just want it to look like the actual Android keyboard but I can make that happen, I'm sure. Thanks!
Post Reply