Skip to main content

Android Virtual Keyboard Problems

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
4 replies [Last post]
lyon37
Offline
Joined: 2011-05-19

I've used the thorsten_s Android port of LWUIT to convert an application to Android. For the most part it seems to work great.

Unfortunately, inputting text into a textfield has some strange behaviours, the hardware keyboard on a G1 seems to work correctly. However, the android virtual keyboard across several different phones (G1, Galaxy S, IDEOS) and virtual keyboards (Android Keyboard, Samsung keypad, Swype) are all problematic.

Some specific examples:

1. With an empty text field enter some text (e.g. "testing"). Delete several characters ("test"). Enter any character ('a'). The text field now contains "testinga", the deleted characters have been re-inserted.

2. Move the cursor to somewhere in the middle of the text you have entered (e.g. after the 's'), press backspace ("tetinga"). Enter any character ('b'). The text field now contains "testingab", the deleted character has been re-inserted and the new character has been entered at the end of the string.

3. Android Keyboard and Swype (not Samsung keypad): Again with an empty text field. Enter a string of numbers (e.g. "1234"), press backspace. No text is cleared until backspace has been pressed x+1 times (x being the number of digits in the string entered).

4. Again with an empty text field. Enter a string of numbers (e.g. "1234"). Enter a non numeric character. The string of numbers is cleared and the text field contains only the non numeric character just entered.

It seems that clear and (on some virtual keyboards) numeric key events are sent to the LWUIT form rather than the InputConnection, and the text field on the form is updated, but the editable object is not.

I've had a look at the LWUITInputConnection and LWUITEditable classes and tried making some changes but with only limited success.

Does anyone have a solution to this problem?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
thorsten_s
Offline
Joined: 2008-08-15

Hi,
I just committed a change to the LWUITInputConnection. I believe it helps with issue 1 and 2. 3 and 4 still fail. Don't have the time right now to look into this. I bet there are still some method implementations missing for the LWUITInputConnection class.

thorsten_s
Offline
Joined: 2008-08-15

I attempted to solve the remaining issues and just could not make it work. I give up. The AndroidImplementation.USE_LWUIT_INPUT_CONNECTION flag enables the LWUITInputConnection again if one wants to give it a try. The current default will just disable any advanced editing features and should work for normal text input, even with constraints.

lyon37
Offline
Joined: 2011-05-19

Thanks for your efforts anyway Thorsten. Your work on the Android port is much appreciated.

madhurvyas
Offline
Joined: 2010-04-05

I have written some code to fix issues with swype (works fine on galaxy s, nexsus s). though its ugly but works.
have a look at the post I submited some time back.
http://www.java.net/forum/topic/mobile-embedded/lwuit/android-implementa...
Now the current implementation code has changed a bit, you need to figure out few things.