Codename one's VKB not showing in android build - codenameone

I have installed an android build of codename one on motorola atrix.
Now I have a textfield. WHen I click on the textfield, android's keyboard shows up.
I don't want that. I want to show Codename One's key board(white and transparent). How do i do that?

There is an API called Display.setDefaultVirtualKeyboard() but it probably won't work for Android since we use native input on Android always by default. The keyboard is the smaller issue, the copy/paste and other features available on these OS's are the main reason we chose the native keyboard.
You can file a bug on this and we can evaluate the complexity of adding something like this, but it will probably be a bit of a pain to fix.

Ok, so with Shai's comment given above: this is how i got android to show codename one's keyboard.
Textfield field = new TextField();
VirtualKeyboard vkb = new VirtualKeyboard();
VirtualKeyboard.bindVirtualKeyboard(field, vkb);//binding the vkb to a particular textfield
Display.getInstance().setDefaultVirtualKeyboard(vkb);
Now, the datachange listener for textfield works smooth. Also the hint of the textfield clears out when textfield receives focus.

Related

Codename One CheckBox with RTL

I have set up a simple form with three checkboxes as shown below.
The problem arises when I use right to left with RTL support.
The boxes then cover the texts in a strange way.
I didn't set the alignment I have only changed the color to blue.
When I don't use RTL, checkboxes look fine!!
Also I tested on iPhone device and the same issue happens.
On Android devices, it works fine but it ignores RTL support!!
Please help me out and thanks in advance.
I think there is a regression with the CheckBox and the opposite side mode. Please file an issue on that. The workaround is to disable the opposite side mode either via the theme constant or:
cb.setOppositeSide(false);

Previous form does not completely disappears on Codename One

My app written with Codename One involves showing a camera preview In a main form. I have used the native interface implementation to make it work on Android (iOS later).
The app also includes in app purchase to upgrade to full version. That's why a form is shown regularly to suggest the user to upgrade. They can also choose to upgrade later which causes this upgrade to full version form to disappear and make the main form with the camera preview to appear.
Yet on real devices sometimes the upgrade to full version form does not completely disappears and there are reminiscences of it on the main form. In that case the camera preview is displayed on part of the screen and the app buttons do not show. However after some seconds if the user touch the screen the main form gets completely shown and the reminiscence of upgrade form are gone.
It looks like there may be too much things done on the UI thread but I am just calling new MainForm(theme).show() when the user hits the button to close the upgrade form. So this should be OK shouldn't it? Please note that the CN1 simulator does not show edt violation (but there is no camera preview in the simulator).
Or do I have to call revalidate () in the MainForm after adding the components into the layout ? What should I do actually to make these reminiscences disappear ?
Any help really appreciated,
These things are always hard to track but I'm guessing the peer component collides in some way with the new form.
Make sure you don't call postInvalidate unless you really have to and even then you should generally limit and avoid it when possible as it might conflict with our drawing logic.
Also make sure you didn't change the opacity of the parent forms e.g. if you changed the form UIID.
It looks like the solution has been found. Indeed I had a native method that initialized the camera and the surfaceview. I was running this method on the EDT and then showing the new MainForm.
Indeed I embraced the initialization method in an invokeAndBlock() block. Now it looks like the kind of lag is far less visible (I could not see it). In my own logic I can explain it with the fact that the invokeAndBlock() will do the initialization job on a separate thread and when it's fully ready (so the camera and surfaceview are ready to be shown), the MainForm can be shown.
Could it be the actual solution #Shai ?

Codename One - Crash due to TextFields

I had my app working just fine a few days ago and then I noticed the first problem. I had to tap twice in order to make a button go to the next screen. Also happened to the checkBoxes. Had to tap twice to make them change.
But now it got serious. Since yesterday when I tap on a TextField the app freezes and then crashes.
The only significant changes I remember I did were 2: I uploaded an image for the App Icon and I edited the TitleArea UIID. I removed the TOP and BOTTOM margins. It also affected some of my label and button UIID, because now they don't show on the device
When I run the simulator, the doble tap also occurs, but the TextFields work fine and the Button and Label UIID look the way they should.
Any ideas why this happens?
I am right now working with old versions to try to determine the reason, but no luck so far. Thanks
Use a solid color rather than a gradient with the same colors. Gradients are slow and problematic across platforms so you are paying a lot for something that you aren't even using.
We'll need a better test case to reproduce crashing, I think that what you initially saw when you submitted the issue was a regression in the text input that we since resolved in the build servers.

Simulator options won't show in Xcode 6.4

I don't get the option to run my app on a certain simulator or anything. I'm trying to upload my app to iTunes Connect but it won't even let me.
Try increasing your screen resolution, or making the Xcode window wider. Then it will reappear.
If you can't do either of those (do to screen resolution constraints), then use the Product menu and then the Destination sub-menu as a workaround.
And by the way, this looks like a duplicate Question #31318316

Displaying android's commands through code in Codename One

I have an android build of codename one
Can i show the command menu through code in codename one for android build?
Right now , i need to click on the menu option to access the commands. Is there any code snippet through which I can make the commands appear on the screen (invoke the menu) ?
Not at the moment since we don't support showing the native command menu and the command menu might not exist (think ActionBar on Android 3.x and newer).
However, showing the "lightweight" menu might work for some cases. Be warned that this is unsupported officially and this is in no way a recommendation to doing this!
You can call Form.getMenuBar().showMenu(), again this will work great in the simulator but on the actual devices your millage might vary in terms of device look/feel.

Resources