destroyApp()与notifyDestroyed()
来源:互联网 发布:剑灵网络加速器哪个好 编辑:程序博客网 时间:2024/05/22 12:56
结束程序的是notifyDestroyed(),而destroyApp()只是说明MIDlet进入程序运行结束状态,但并未真正结束。而且notifyDestroyed()不一定必须在destroyApp()之后执行,可以单独执行。
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class NotifyDemo extends MIDlet implements CommandListener
{
Display display;
Form form;
Command exitCommand;
Command finishedCommand;
public NotifyDemo()
{
display=Display.getDisplay(this);
form=new Form("测试程序结束命令");
form.append("按离开键执行destroyApp(false);/n按结束键执行notifyDestroyed()");
exitCommand=new Command("离开",Command.EXIT,1);
finishedCommand=new Command("结束",Command.EXIT,1);
form.addCommand(exitCommand);
form.addCommand(finishedCommand);
form.setCommandListener(this);
}
public void startApp()
{
display.setCurrent(form);
}
public void pauseApp(){}
public void destroyApp(boolean uncondition)
{
form.append("按离开键执行了destroyApp(false)方法体");
}
public void commandAction(Command cmd,Displayable disp)
{
if(cmd==exitCommand)
destroyApp(false);
else if(cmd==finishedCommand)
{
//destroyApp(false);//去掉此句不影响程序结果
notifyDestroyed();
}
}
}
- destroyApp()与notifyDestroyed()
- 关于notifydestroyed() 与 notifypause()
- 关于destroyApp(参数)问题
- super(true) destroyApp(true) 部分英文缩写
- J2ME中destroyApp()、pauseApp()、startApp()、构造方法的调用顺序
- [解释]Super(true)和destroyApp(参数)到底是什么意思?其他小问题
- 与
- 与
- “” 与 “”
- ##与#
- >> 与 > >
- :与::
- &与&&
- && 与 &
- [[与((
- >>与>>>
- *与++
- *与++
- “无法获取web应用程序服务”是什么错误?-
- 看晦涩的语法书,不如看一段优秀的代码
- SqlDataSource with select command
- T-SQL查询基础
- 今天的开始
- destroyApp()与notifyDestroyed()
- 随笔(心之语)
- 动态内存分配到底为谁分配内存空间
- 如何清空界面的内容
- Ajax 动态刷新例子分析(实现级联更新)
- jdk , tomcat 下载,安装与配置
- 基于P2P的聊天
- 构造函数与startApp()函数
- 你学的是哪门语言?