Hi,
I wrote the following small code . It compiles an works fine in wtk emulator. But it just does not run in N72.
Then I tried to remove the static final fields one by one .. I did not try all of them , But removing some commands or removing the alert fixes the problem.
Also if I go lazy, initialize the variables in the startApp(), then this is not a problem.
Is it some kind of memory exception or a new bug revealed ?
Code:/** * * @author Kamanashis Roy */ package net.ayaslive.miniim.ui; import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Canvas; import javax.microedition.lcdui.Graphics; import javax.microedition.midlet.MIDlet; import javax.microedition.midlet.MIDletStateChangeException; public class App extends MIDlet implements CommandListener { private static App self = null; private static Alert singleAlert = new Alert("TEST"); private final static Command YES_POSITIVE = new Command("YES", Command.OK, 1); private final static Command NO_POSITIVE = new Command("NO", Command.CANCEL, 1); private final static Command YES_NEGATIVE = new Command("YES", Command.CANCEL, 1); private final static Command NO_NEGATIVE = new Command("NO", Command.OK, 1); private final static Command OK_CMD = new Command("OK", Command.BACK, 1); public void destroyApp(boolean unconditional) { notifyDestroyed(); } protected void pauseApp() { } public void commandAction(Command cmd, Displayable dis) { } /** * Startup step */ private int step = 0; protected void startApp() throws MIDletStateChangeException { try { Canvas canvas = new Canvas() { protected void paint(Graphics g) { final int height = getHeight(); final int width = getWidth(); final int halfHeight = height/2; final int RESOLUTION = 15; final int PADDING = 2; final int fillWidth = width - RESOLUTION - RESOLUTION; // clear g.setColor(0xD3D7CF); g.fillRect(0, 0, width, height); // fill step% g.setColor(0x888A85); g.fillRect( RESOLUTION, halfHeight - RESOLUTION, fillWidth*step/100, RESOLUTION); g.drawRoundRect(RESOLUTION, halfHeight - RESOLUTION, fillWidth, RESOLUTION, PADDING, PADDING); } }; // show the canvas Display.getDisplay(this).setCurrent(canvas); // show progress for(int i=0; i<100; i+=10) { this.step = i; canvas.repaint(); canvas.serviceRepaints(); Thread.sleep(1000); } // cleanup canvas = null; } catch(Throwable t) { t.printStackTrace(); } } }

Reply With Quote
. The problem is when I start the application, there is a flicker and the application goes dead.

