PDA

View Full Version : خروج از برنامه موبایل؟



canvas_for
شنبه 12 آبان 1386, 15:27 عصر
import javax.microedition.lcdui.*;
public class MIDPCanvas extends Canvas implements CommandListener {
public MIDPCanvas() {
try {
setCommandListener(this);
addCommand(new Command("Exit", Command.EXIT, 1));
} catch(Exception e) {
e.printStackTrace();
}
}

public void paint(Graphics g) {
g.drawString("Sample Text",0,0,Graphics.TOP|Graphics.LEFT);
}
protected void keyPressed(int keyCode) {
}
protected void keyReleased(int keyCode) {
}

protected void keyRepeated(int keyCode) {
}

protected void pointerDragged(int x, int y) {
}

protected void pointerPressed(int x, int y) {
}

protected void pointerReleased(int x, int y) {
}

public void commandAction(Command command, Displayable displayable) {
if ( command.getCommandType()==Command.EXIT)
notifyDestroyed();
}

}


من اگه بخواهم برنامه را پایان بدهم باید چی کار کنم؟

notifyDestroyed();
در اینجای برنامه جواب نمی ده

handinux
شنبه 12 آبان 1386, 21:04 عصر
destroyApp(true);
notifyDestroyed();

canvas_for
دوشنبه 14 آبان 1386, 10:41 صبح
destroyApp(true);
notifyDestroyed();
منظورم این بود که تابع notifyDestroyed(); را نمی شود وسط کلاس canvas صدا زد
تست کن error می دهد!