java-me

Png Image support of J2ME WTK Emulator

孤者浪人 提交于 2019-12-08 01:32:24
问题 I use a png image in my project that is not displayed in emulator but it can be displayed in phone. Then i open it with photoshop, save as png and use that image. It is displayed both emulator and phone. I couldn't figure out the difference of original and edited one. And is there any setting of emulator for image display? And how can i understand any png file is supported or not? original image edited image 回答1: I preferred PNG files is good for MIDP. You can check following links, It will

OutOfMemoryError in j2me application

三世轮回 提交于 2019-12-07 23:48:32
问题 I am getting OutOfMemoryException in a J2ME Application. How can I find what is causing this error? And how to prevent getting this error ? I make a http request. While the request isn't completed the screen shows a loading image (like a browser shows when a page is loading). This was done by creating an Image and repainting the screen. create image 1 -> repaint -> create image 2-> repaint-> create image 3 -> repaint -> create image 1-> repaint -> . I noticed (using wtk memory monitor) that

Stop a thread after period of time

萝らか妹 提交于 2019-12-07 22:24:02
问题 How can I stop a thread running after it has been running for 5 seconds ? I am unable to use java 5+ threading features (must work in j2me). Possible solution - Schedule two threads. One which performs the actual work(T1) and the other which acts as monitor of T1(T2). Once T1 has started then start T2. T2 calls the isalive() method on T1 every second and if after 10 seconds T2 has not died then T2 invokes an abort on T1, which kills the T1 thread. is this viable ? Timer timer = new Timer();

In J2ME, How I obtain reference of all controls of the form to record form's controls state changes?

五迷三道 提交于 2019-12-07 20:46:28
In my J2ME app, I want show an alert dialog box only when the user changes the state of any controls—that is, when the user uses any of the control of the form and then try to cancel the form without saving typed data. For example among all 5-6 controls of form if the user types in 1-2 textfields and tries to cancel the form without saving that typed data into database. An alert box should then display with the message "Save changes?" with Yes, No command. How to do this? This is my code which does not give the desired result: import javax.microedition.lcdui.*; import javax.microedition.midlet

how to parse this json response?

℡╲_俬逩灬. 提交于 2019-12-07 19:32:29
问题 i know how to parse response like {\"screenTitle\":\"National Geographic\"} token.optString("screenTitle"); up to this ok. but see this response { "status": "OK", "routes": [ { "summary": "Southern Exp", "legs": [ { "steps": [ { "travel_mode": "DRIVING", "start_location": { "lat": -34.9257700, "lng": 138.5997300 }, "end_location": { "lat": -34.9106200, "lng": 138.5991300 }, i want the lat and long value. how can i achive this. 回答1: Nothing will be able to parse the string that you've provided

How to access SIM contacts in Blackberry

我只是一个虾纸丫 提交于 2019-12-07 19:23:10
问题 I need to access contact list in blackberry, I writ following code to do that: private void readContacts() { try { PIM pim; pim = PIM.getInstance(); String lists[] = pim.listPIMLists(PIM.CONTACT_LIST); for (int i = 0; i < lists.length ; i++) { clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY, lists[i]); Enumeration cenum = clist.items(); while (cenum.hasMoreElements()) { Contact c = (Contact) cenum.nextElement(); ContactDTO contact = new ContactDTO(); parseContactInfo(c,

New BlackBerry text selection mode

允我心安 提交于 2019-12-07 18:21:49
问题 In recent versions of OS6, text selection has changed. I am using an ActiveRichTextField and in BlackBerry OS pre-6.0 as well as older versions of 6.0, such as 6.0.0.246, the focus would move though each character with the inverse block showing current position. The context menu has "Select" as an option, and uses the current focus position as the selection start, and any focus movement would mark the other end of the selection. With 6.0.0.526, the focus no longer draws an inverse block on

BitmapField click does not work on Blackberry application

Deadly 提交于 2019-12-07 18:21:31
问题 i arranged 7 bimapfield in horizontal if i click the bitmapfield it want to push the another screen Here is my code but i did't get the another screen can any one help me whats wrong in this code BitmapField bitmap1 = new BitmapField( Bitmap.getBitmapResource("profile_n.png"),FOCUSABLE | DrawStyle.HCENTER) { protected void onFocus(int direction) { rollno=1; this.getScreen().invalidate(); } protected void onUnfocus() { } protected boolean navigationClick(int status, int time){ UiApplication

Open file with MIDlet.platformRequest()

寵の児 提交于 2019-12-07 17:36:51
问题 Is it possible to get a device to open a file on disk using the MIDlet.platformRequest(String url) method? I was hoping to use the following: midlet.platformRequest("file:///path/to/file/file.png"); But this just throws a ConnectionNotFoun d exception. I'm specifically using the BlackBerry platform, but I do not have access to the proprietary BlackBerry API. File could be of any type, so obviously I'm not expecting it to handle every one. Cheers 回答1: No, it is not possible to open arbitrary

Using boolean var for stopping threads

 ̄綄美尐妖づ 提交于 2019-12-07 17:29:52
问题 I have a Java book I'm learning from and in one of the examples, I saw something suspicious. public class ThreadExample extends MIDlet { boolean threadsRunning = true; // Flag stopping the threads ThreadTest thr1; ThreadTest thr2; private class ThreadTest extends Thread { int loops; public ThreadTest(int waitingTime) { loops = waitTime; } public void run() { for (int i = 1; i <= loops; i++) { if (threadsRunning != true) { // here threadsRunning is tested return; } try { Thread.sleep(1000); }