midletlifecycle2.java

来自「java手机程序开发随书光盘源代码」· Java 代码 · 共 38 行

JAVA
38
字号
import javax.microedition.midlet.*;

public class MIDletLifeCycle2 extends MIDlet{

	boolean everPaused = false;

	public MIDletLifeCycle2(){
		
		System.out.println("MIDletLifeCycle is initialized!");
	}

	public void startApp(){
		
		if(!everPaused){	
			System.out.println("startApp() is called!");
			pauseApp();
			notifyPaused();
			resumeRequest();
		}
		else{
			System.out.println("startApp() is called twice!");
			destroyApp(true);
			notifyDestroyed();
		}
	}

	public void pauseApp(){
		
		everPaused = true;
		System.out.println("pauseApp() is called!");
	}

	public void destroyApp(boolean unconditional){
		
		System.out.println("destroyApp() is called!");
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?