- Home /
Android 4.0 ( ICS ) Keyboard issue
Hi all,
I'm nearly done with a game for Android, but I'm running into some issues with Unity's text fields and the ICS keyboard, which I have noticed, as have 3 of my testers ( Stock Galaxy Nexus and Nexus S users ).
When the keyboard comes up for the first time, everything works as expected. If you dismiss it using the "Ok" button next to the popped up text entry, it works as expected. If you dismiss it with the "Done" button on the keyboard, the keyboard often does not present itself in other text fields and I can't find a consistent to bring it back up. It sometimes takes a few attempts, but this is definitely reproducible.
I'm not using any custom handling of my text fields:
opponent = GUI.TextField(Helpers.ButtonRect(y), opponent, 60);
Is there anything I can do to work around this issue? I am planning to release soon, and this is sadly a critical bug.
A beta version is online here so you can see: http://bit.ly/ItCVgu
Thanks, David Goemans
If you don't want to answer the question, don't post an answer.
I've converted your answers into a comment.
Answer by nitz · Jul 11, 2012 at 11:13 PM
Edit! I've changed the way I've done my workaround, so maybe it'll be more effective.
I keep a reference in one of my classes to an instance of TouchScreenKeyboard:
private TouchScreenKeyboard keyboard = null;
in my Start(), I instanciate a keyboard:
keyboard = new TouchScreenKeyboard("", TouchScreenKeyboardType.Default, true, true, false, false, "");
keyboard.active = false;
then, when I want to ensure my keyboard is re-shown, I do:
keyboard.active = false;
TouchScreenKeyboard.Open("current text from text area", TouchScreenKeyboardType.Default, true, true, false, false, "");
I call that code when the user taps on an area that would be a text area. Something like this (pseudocode)
foreach (textarea t in alltextareas)
if (Input.GetMouseDown(0) && t.MouseIsOver && t.IsClickable)
ForceShowKeyboard()
Surely there's a better way, but I imagine it will require Unity to change how they interact with the keyboard API on ICS.
Good luck!
Thanks! The key to work for my Galaxy Tab 2 7.0 was the second block of code.
It's worth noting that this bug has now been fixed in 3.5.6.
Your answer
Follow this Question
Related Questions
Unity TouchScreen Keyboard questions.. 0 Answers
How to simulate a keypress in an onclick button on mobile(android/ios)??? 1 Answer
Click a button when keyboard is open (Android) 0 Answers
Editable text field in Android with cursor 0 Answers
Mobile Keyboards -- Highlighting all text by default when keyboard is opened (iOS vs. Android) 0 Answers