java-me

Rounding a double to 5 decimal places in Java ME

一世执手 提交于 2019-11-28 10:04:25
How do I round a double to 5 decimal places, without using DecimalFormat ? You can round to the fifth decimal place by making it the first decimal place by multiplying your number. Then do normal rounding, and make it the fifth decimal place again. Let's say the value to round is a double named x : double factor = 1e5; // = 1 * 10^5 = 100000. double result = Math.round(x * factor) / factor; If you want to round to 6 decimal places, let factor be 1e6 , and so on. Whatever you do, if you end up with a double value it's unlikely to be exactly 5 decimal places. That just isn't the way binary

Displaying Alert with Yes, No Command

你离开我真会死。 提交于 2019-11-28 09:54:20
问题 At the J2me application I used an alert with yes, no command. If user clicks the yes command Form Screen will be displayed and if clicks the no command TextBox screen will be displayed. But the code does not work. For two command only textbox screen will be displayed. This is my code: public Login(){ yes=new Command("Yes",Command.OK,1); no=new Command("No",Command.CANCEL,1); alert=new Alert("","Save The Changes?",null,AlertType.CONFIRMATION); alert.setTimeout(Alert.FOREVER); alert.addCommand

how do I access mobile inbox, call log, photo gallery using j2me APIBridge?

筅森魡賤 提交于 2019-11-28 09:45:13
问题 I was searching for the method or some kind of examples, by which i can access my mobile phone call logs or message inbox. But, I failed to find, because in all blogs and even in this site (Stack Overflow), everyone saying that, it can't be possible. Today, I found this answer, which increase my hope, which I wanted to do. As Lucifer said, using APIBridge we can achieve this. Then, I found this example, in which accessing call logs and photo gallery has been explained. But, when i was trying

Error: Cannot run program “jar”: CreateProcess error=2, The system cannot find the file specified

时间秒杀一切 提交于 2019-11-28 09:42:33
When I run my BlackBerry project in Eclipse, I get the following error: Error: Cannot run program "jar": CreateProcess error=2, The system cannot find the file specified How is this caused and how can I solve it? prinujith you can solve this problem by following setting Right Click My Computer -> Select Properties-> Select AdvancedSystem Settings Tab -> Environment variables Click on new button and Add Variable Name : JAVA_HOME Variable Value : C:\Program Files\Java\jdk1.7.0\ note jdk not jre Finally I get the solution .copy the jar.exe from java bin folder and paste to the jre bin folder. I

You must include the platform port before the LWUIT in the classpath runtime exception

╄→гoц情女王★ 提交于 2019-11-28 09:37:21
问题 I recently started using LWUIT. Great job and great program. I'm using Netbeans 6.9.1, S60 SDK and the webstart version of LCWUIT. The first problem I faced was that I couldn't preverify Transitions3D.java file , however that was not an issue. I just removed that part of the code and recompiled the library from scratch. So I created a simple form with a "Hello World" Label and tried the "Create Netbeans Project" option of the resource editor. I did a Clean Build at the test_MIDP (where test

Serialization via J2ME or BlackBerry APIs

岁酱吖の 提交于 2019-11-28 09:05:40
问题 Is it possible to serialize an object into a string or a byte array using either the J2ME or BlackBerry APIs? Thanks. 回答1: The way I handle the object serialization case is by implementing my own infrastructure for handling everything. You don't have reflection in this API, but you do have "Class.forName()" which is better than nothing. So here's what I do... First, this is the interface that I have every serializable object implement: public interface Serializable { void serialize(DataOutput

Dynamic table in lwuit

孤街醉人 提交于 2019-11-28 09:02:44
问题 How to create a Dynamic table in lwuit TableModel model = new DefaultTableModel( new String[]{"A", "B", "Call Avg"}, new Object[][]{ {"0", "50", "0.00"}, {"0", " " + "2", "0.00"}, {"0", "52", "0.00"},}) { public boolean isCellEditable(int row, int col) { return col != 0 ; } }; Table table = new Table(model); This is for static . I want to create dynamically number of rows and columns .. Plz help 回答1: See this sample code. I have created dynamic table with LWUIT using this code. Form form =

Java ME UI libraries

徘徊边缘 提交于 2019-11-28 08:33:58
I'm developing a Java ME app & need pointers to some really good UI libraries. I did see a few such as Java ME Polish. Are there any more out there? For e.g. ebuddy's java ME app has an amazing UI and so is gmail's java ME app. What libraries would they have been using or would have they have developed it on their own? Sun recently released and opensourced their solution to crappy looking lcdui. It is called LIghtweight UI Toolkit and can be found on lwuit.dev.java.net We have been trying lately on kuix.. So far so good and more light weight than LWUIT code. http://code.google.com/p/kuix eSWT

Logging in J2ME

倾然丶 夕夏残阳落幕 提交于 2019-11-28 06:28:49
What logging solutions exist for j2me? I'm specifically interested in easily excluding logging for "release" version, to have a smaller package & memory footprint. If you are using preprocessing and obfuscation with Proguard, then you can have a simple logging class. public class Log { public static void debug(final String message) { //#if !release.build System.out.println(message); //#endif } } Or do logging where ever you need to. Now, if release.build property is set to true, this code will be commented out, that will result in an empty method. Proguard will remove all usages of empty

Image rotation algorithm

喜欢而已 提交于 2019-11-28 06:26:02
I'm looking for an algorithm that rotates an image by some degrees (input). public Image rotateImage(Image image, int degrees) (Image instances could be replaced with int[] containing each pixel RGB values, My problem is that i need to implement it for a JavaME MIDP 2.0 project so i must use code runnable on JVM prior to version 1.5 Can anyone help me out with this ? EDIT: I forgot to mention that i don't have SVG APIs available and that i need a method to rotate by arbitrary degree other than 90 - 180- 270 Also, no java.awt.* packages are available on MIDP 2.0 earino One of the best pages