codenameone

Is there a way to limit the duration of an audio capture in Codename One?

坚强是说给别人听的谎言 提交于 2019-12-08 07:34:27
In my Codename One app, I need to limit the duration of an audio capture to few seconds. I call Capture.captureAUdio() for that and there does not seem to be an equivalent to Capture.capturePhoto(w, h) that could bound the captured audio to a given duration. What I've done so far is measure the audio capture duration and if it is too long then ask the user to start again if they will. But I find it a bit cumbersome. Is there anything better that can be done ? Any hint appreciated, No. For audio though you can use use the media recording feature from MediaManager which isn't as intuitive as

Codename one: Why does the android button have a different appearance than the IOS button

一笑奈何 提交于 2019-12-08 07:17:21
问题 I am currently styling my App with the css plugin for codename one and I cannot figure out why the default look of the Button is different for android and IOS. In IOS it looks like this: In Android it looks like this: It should look like it does in IOS for all devices. In the Css file, I have this entry for Button: Button { cn1-derive: Button; background-color: #005EA8; color: white; } Button.unselected { cn1-derive: Button.unselected; background-color: #005EA8; color: white; } Button.pressed

Codename one scrollbar coming back

随声附和 提交于 2019-12-08 06:48:19
问题 Scrollbar coming back when I send new Android build. I was add this code to hide scrollbar and everything fine, I didn't change anything. UIManager.getInstance().setLookAndFeel(new DefaultLookAndFeel(UIManager.getInstance()) { @Override public void bind(Component cmp) { if (cmp instanceof Container) { cmp.setScrollVisible(false); } } }); 回答1: I'm not sure why this fails but a better approach would be defining the theme constant scrollVisibleBool=false . 来源: https://stackoverflow.com/questions

Codename One - Method to enlarge or reduce all the fonts in all the styles

大兔子大兔子 提交于 2019-12-08 06:33:39
问题 Suppose that I have a Codename One app with a complex set of themes (that are overlayed) or an app that has only one theme that is complex. My question is if I can have simple Java code to enlarge or reduce by a given percentage all the font sizes (that are in mm) of all styles. I know that I can overlay a theme that changes all the font sizes, but in some conditions can be painful. 回答1: int fontSize = Display.getInstance().convertToPixels(3); Font tt = Font.createTrueTypeFont(s, s).derive

Scrolling down not working when dragging an element and simultaneously adding/removing components to the form

主宰稳场 提交于 2019-12-08 06:29:51
问题 When I am dragging an element down, the form doesn't scroll down when the dragging reaches the bottom. The reason for this may be that I am manipulating the content of the form by adding an empty placeholder component under the dragged component, and then removing and adding the placeholder each time the dragged component moves over another component. I call revalidate each time the placeholder is removed/added. Strange thing is that the scrolling works fine when dragging upwards. Any

Android build fails in codenameone build sever

若如初见. 提交于 2019-12-08 06:24:35
问题 My android build fails after build and this is the error log i get Total time: 1 mins 16.631 secs Stopped 0 compiler daemon(s). Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':dexRelease'.] from daemon DaemonInfo{pid=5907, address=[10331ba5-2501-41cc-aa13-52a0ba46bd51 port:41817, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=2862cb6d-50e8

Codename One - addActionListener of a Picker

折月煮酒 提交于 2019-12-08 06:19:25
问题 The following code, in a lot of version of Android and iOS, shows the options "Cancel" and "OK". I would like that the addActionListener code is executed only when the user taps on the "OK" button. At the moment, that code is executed even if the user taps the "Cancel" button: Form hi = new Form("Hi World", BoxLayout.y()); Picker languagePicker = new Picker(); languagePicker.setType(Display.PICKER_TYPE_STRINGS); languagePicker.setStrings("Italian", "English", "German"); languagePicker

Native interface in codenameone for getting battery information (Duplicate)

余生颓废 提交于 2019-12-08 06:09:41
问题 I need to get the battery level (percentage) as soon as the device turns off. The following code gives build failed error. I've included the code and build error below. Thankyou. MyNativeImpl.java public class MyNativeImpl { public boolean isSupported() { return true; } public float getBatteryPCT() { IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); Intent batteryStatus = this.registerReceiver(null, ifilter); int status = batteryStatus.getIntExtra(BatteryManager.EXTRA

Codename One - addConstraint to PickerComponent date

做~自己de王妃 提交于 2019-12-08 06:09:19
问题 I need to check if the user is at least 13 years old. The problem is that the object given from PickerComponent to its Validator is a String, instead of a Date (as I expected). That String is formatted according to my locale (in the Simulator), so for the "May 9, 2003" I get the String "09/05/03" (I'm also surprised that the year is indicated only by two digits instead of four). So... I tried the following code, but it doesn't work (in my locale). I need a working Validator for a Date

Clarification on how Codename One UITimer works

孤街醉人 提交于 2019-12-08 06:01:54
问题 I need a clarification about the Codename One UITimer . For example, if I want to execute the same code every two seconds, a code like UITimer.timer(2000, true, () -> { do something; }); works until the user stays in the current Form ? Is that right? If I want to execute the same code every two seconds regardless the shown Form , have I to use something different from UITimer , like a custom separate thread? For example the following code? Form hi = new Form("Hi World", BoxLayout.y()); hi.add