Pass j2-midp State

Source: Internet
Author: User

For the Midlet Status, application management software is responsible for management. All you need to care about is how to deal with this AM.
PauseApp ()
DestroyApp ()
StartApp ()
Rewrite these three methods. AM will be called at the corresponding time.
While
NotifyDestroyed ()
NotifyPaused ()
ResumeRequest ()
It gives you the opportunity to notify AM about what to do.
The following is a simple example, which can be expanded and tested by yourself. One strange thing is that, in theory, when the Midlet is in Active state, if a call enters, AM will call pauseApp (). However, in the actual test, the method is not called by AM.
Package net. csdn. blog. vincint;
Import javax. microedition. midlet .*;
Import javax. microedition. lcdui .*;
/**
* This is a simple test to help me understanding the Midlet state
*
* <P> Title: Midlet Test </p>
* <P> Description: </p>
* <P> Copyright: Copyright (c) 2005 </p>
* <P> Company: A http://blog.csdn.net/Vincint </p>
* @ Author Vincint
* @ Version 1.0
*/
Public class MidletState
Extends MIDlet
Implements
CommandListener {
Protected Form form;
Protected Command exitCmd;
Protected Command debugCmd;
Protected Display display;
Protected String debug;
Public MidletState (){
AddDebugInfo ("In MidletState ()");
Display = Display. getDisplay (this );
Form = new Form ("Hello world .");
Form. append ("What a new world! ");
ExitCmd = new Command ("Exit", Command. EXIT, 1 );
DebugCmd = new Command ("Debug", Command. SCREEN, 2 );
Form. addCommand (exitCmd );
Form. addCommand (debugCmd );
Form. setCommandListener (this );
}
/**
* StartApp
*/
Protected void startApp (){
AddDebugInfo ("In startApp ()");
Display. setCurrent (form );
}
/**
* PauseApp
*/
Protected void pauseApp (){
AddDebugInfo ("In pauseApp ()");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.