This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!

Derek Smith

+ Follow
since Jan 28, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Derek Smith

I am pretty consistently experiencing problems with the Palm Emulator used with J2ME code. I can run the same code on other emulators within Forte/J2ME Toolkit and have no problems, but then when I switch to the Palm_OS emulator, I'll get a failure every time.
Code is opening an HTTPConnection, sending POST data and then creating inputDataStream to receive results. I call the same routine for each HTTP request...first time is fine, second time is fine, third time fails with NullPointerException on in=conn.openDataInputStream() call.
I have tried to make sure to close connections and clean up variables (general J2ME good practice) but again, I only experience this on the Palm OS emulator.
Any insight is appreciated!
20 years ago
I had the same problem. Just putting the package into the same directory structure is not also have to reference it in the MIDlet Suite that is created.
I use Forte with the J2METK add-in. In there, right click on the MIDlet Suite, select open, and on the 'Content' tab, make sure the directory for kXML is added to the 'Chosen Content' list.
I know this worked for kXML, and I suspect it would be the same for other external libraries.
20 years ago
Absolutely! J2ME includes packages for handling network communications including HTTP. So, in the same way that you could build an n-tier application that accesses a DB via a browser, you can build one that uses the mobile device as the client. What's even better is that the client can be very rich since Java is a full blown language, not just scripting (as in HTML or WAP).
Check out MIDP package for usage.
20 years ago
I have done what you are asking by putting thread creation and starting in the commandAction() routine of the Midlet. This is a common way to handle background/multithreaded network connections, etc.

else if (c == cmdGo) {
//call login routine

String strUID = txtUID.getString();
String strPIN = txtPIN.getString();

//create thread for login
INETThread login = new INETThread(INETThread.LOGIN, strUID, strPIN);
The thread will run but any code that follows from the .start() will allow control of phone by you can display a screen, etc.
Check out for good example.
It has become quickly clear to me that the MIDP API has made a few changes to the java.util.Random class, particularly getting rid of the Random.nextDouble() method.
So, how would you create a pseudorandom number between x and y using only the nextInt() method? I have tried a number of varieties and none have yielded accurate results.
Thanks in advance...
20 years ago