i have case in j2me .. i want terminate when app in process execute code. this is my simple code.
else if (c == cmdStop) {
//command berhenti
browser.stop();
}
public void stop(){
// No errors
int errorCode = 0;
// An error occurred
errorCode = -1;
// Terminate
System.exit(errorCode);
}
the problem is when i try to terminate app, the app still worked or continue execute and ignore function system.exit.
still excecute this code
private void paintParserScreen(Graphics g){
int w = width;
int h = fontHeight+2;
int x = 0;
int y = height - h;
int curLoaded = 0;
int value = 0;
int iPercent = 0;
if(maxElementNum!=0){
curLoaded = wapRender.getCurLoadedTag();
value = curLoaded * 100 / maxElementNum;
iPercent = (curLoaded * (w - 2)) / maxElementNum;
}
g.setColor(0x808080);
g.fillRect(x, y, w, h);
g.setColor(0x0000ff);
g.fillRect(x + 1, y + 1, iPercent - 2, h - 1);
g.setColor(0xffffff);
g.drawString("proses..." + value+"%",
width>>1, y + 1, Graphics.TOP|Graphics.HCENTER);
}
and they said
java.lang.SecurityException: MIDP lifecycle does not support system exit.
at java.lang.Runtime.exit(+9)
at java.lang.System.exit(+7)
at com.gameislive.browser.Browser.stop(+8)
at Tampilkan.commandAction(+147)
at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+250)
please help me what should i do for this case?