Skip to main content

Problem with Android virtual Keyboard

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
19 replies [Last post]
ugochirico
Offline
Joined: 2009-11-04

Hi,

I found a very strange and unwanted behaviour/bug with the Android Virtual Keyboard.

I added a TextField to a form. When I tap on the textfield the Android Virtual Keyboard appears
But, if I click on the android back button the keyboard disappear and never will appear even if I tap again on the text field. In addition, after the keyaboard disappeared if I click again on the back button, the application goes in pause and when I try to run it again by tapping on the related icon the app wakes up and displays a black screen. At his point I must kill the task to get the app working again.

I'm using LWUIT 1.5 with the thorsten's port dated 28 august 2011.

You can reproduce the bug simply by adding a textfield in form and doing what I said above.

Is there a solution for that?

Thanks,

ugos

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vprise
Offline
Joined: 2003-11-07

I haven't run into this. We have our own Android port that works rather well with native input.

We sent the code to Thorsten but at some point our mutual changes were too big for both sides to keep the pace so I'm not exactly sure where the issue is.

ugochirico
Offline
Joined: 2009-11-04

Hi vprise,

maybe I didn't get what you said. You have a new android port different from the thorsten's one? If so, where can I get it?

ugochirico
Offline
Joined: 2009-11-04

I vprise,
I didn't make any change neither to the torsten's port nor to LWUIT 1.5, this means that if you try what I said with yout version, that is really simple to try, you can see the wrong behaviour.

Let me know....

68060
Offline
Joined: 2011-08-29

I came here this second to report exactly this - im about to deliver my android port to a client and I have just been testing quite throughly - I find that the focus has some issues, if you are careful and click then type then select done, often it all works beautifully, however sometimes you can focus the textfield just fine but the virtual keyboard wont pop up, this makes it completely unusable :-(.. Is there a way to get your new port of lwuit for android vprise? We would really love to get something with focus fixed and a few of the other things like the activity handling..

As for the black screen issue it seems to be exiting the activity then not loading again, is there a way we can finish it atleast so it goes back to the main home screen? I will be looking into these issues tommorow again but lets please collaborate my client need this this week :-/

Half the problem is I cant add some andorid specific code that requires the context or activity in my main lwuit project, I have the main project in one version of netbeans, then a script that copies the preprossed code into another project in a different version of netbeans, but from my lwuit project i cant for instance call finish() as I have no access to the activity within the StateMachine class.. I must say for the whole it works really well but these few issues make it very difficult. Another one I have is that in my j2me one i have a textfield where if they select it it pops up a date selector, but on android i can only get this to happen by double pressing the trackball, since most android phones dont have a trackball this is another worry, i guess im thinking i should replace these textfields for a simple button that would work ..

If you can vprise we would both love a new drop of android lwuit... <on my knees praying!!!!!>...... keep up the good work!!!!

Gaz (ps cant wait for codenameone).

gt8887b
Offline
Joined: 2010-03-15

The issue of black screen (activity being recreated) was solved for me by adding android:configChanges="keyboardHidden|orientation" as an attribute of <activity> tag this prevents the activity from being recreated when screen orientation changes (thanks to thorsten_s). I also have the attribute android:launchMode="singleTop" set. This is because I also have a service in my application, but that serves a similar purpose for it causes the system to route intents to the existing activity rather then creating a new one.

ugochirico
Offline
Joined: 2009-11-04

Hi

I solved the following bugs:

  • setMaxSize doesn't work
  • wrong behaviour on back arrow (with blank screen on restart)
  • wrong behavior when more TextFields are in the same form

Attached there is my patch. I'm stiil testing it so, something more may be changed.
You may test it and report me if somthing is still wrong,

Also, add this line to your call after Display.init

AndroidImplementation.USE_LWUIT_INPUT_CONNECTION = true;

Let me know...

68060
Offline
Joined: 2011-08-29

Hi I really want to use this but it seems like I need more instructions, is this the entire class? Can you just post your entire class as it is now please? Also where is Display.init ?

ugochirico
Offline
Joined: 2009-11-04

This is the entire class InvisibleTextEdit.java that you have to overwrite in the LWUIT source code and then you have to recompile LWUIT

68060
Offline
Joined: 2011-08-29

Hi it sort of fixes it which is great, altho now im getting weird behaviour, its as if its going back when i select items to focus on sometimes?

68060
Offline
Joined: 2011-08-29

thanks very much!

68060
Offline
Joined: 2011-08-29

Seems like Slashes sometimes appear on the entirely wrong textfield, any ideas?

68060
Offline
Joined: 2011-08-29

ugochirico - does this solve the edittext bug where the keyboard stops popping up???

ugochirico
Offline
Joined: 2009-11-04

Yes. I tried with my apps and it seems that is is solved.

Try and let me know.

vprise
Offline
Joined: 2003-11-07

Thank's. We'll take a look at it for Codename One ( http://www.codenameone.com/ ).

68060
Offline
Joined: 2011-08-29

Basically had to halt the Android and BB release of my new app, much to clients dismay, the bugs are just too bad to release a version - it would rile people up. Thus the android one cant be released because of the focus and blackscreen issues. The Blackberry one is more of a RIM issue - we have made a StateMachine class that is far too big and it simply wont run on the device, release will be delayed or cancelled because its going to take so long to refactor a 20,000 line class and probably introduce too many bugs.

Basically ive lost a huge chunk of money due to this and client has dumped me.. awesome!!

ps - if you can release code for a better port I might still be able to salvage my situation I guess..

vprise
Offline
Joined: 2003-11-07

Sorry to hear that. We got production apps going on both devices with the GUI builder.

We are pretty busy getting Codename One off the ground but if you email me in my private email I can zip up our old Android port which was still based on LWUIT. It should be somewhere in my HD.

68060
Offline
Joined: 2011-08-29

Hi vprise, thanks very much!! I cant find your email anywhere, but ifyou can email me I would be very grateful!! Its gareth.murfin@gmail.com - I have found the same issue in the tipster demo so im wondering if its actually fixed, it does seem to be you hit a textfield, then hit back key then the keyboard wont pop back up again when you touch them - either way the could would be good to try out!

Looking very much forward to CN1!

Thanks again,

Gaz.

ugochirico
Offline
Joined: 2009-11-04

Hi vprise,

codename one is really interesting.

I see that you ar trying to add some other languages. Are you interested in integrating a Prolog engine?
I'm going to release the new version of JIProlog that will work also on Android, as well as on J2ME and BlackBerry.
This is the current url: http://www.ugosweb.com/jiprolog

Let me know...

bjcoredev
Offline
Joined: 2008-06-13

Hi,

I'm using LWUIT 1.5 with the last thorsten's port.
I've patched InvisibleTextEdit.java with the ugochirico 'one.
with

Display.init(this);

AndroidImplementation.USE_INVISIBLE_TEXT_INPUT_CONNECTION=true;
AndroidImplementation.USE_LWUIT_INPUT_CONNECTION=true;

in onCreate Activity method

When i am in a form with multiple TextFields:
I focus on the first, enter some text.It's running fine.
Without clicking on OK 's virtual keyboard, I set focus on the second ,
enter some text.It's running fine.
Without clicking on OK 's virtual keyboard, I set focus on the third. the characters i enter go on the second TextField !!!!!

When i click on OK 's virtual keyboard at the end of all TextField editing, it's running fine.

When i set
AndroidImplementation.USE_INVISIBLE_TEXT_INPUT_CONNECTION=false;
AndroidImplementation.USE_LWUIT_INPUT_CONNECTION=false;

All is running fine but i'havent of course the Text Prediction feature.

Thanks in advance for your help