Learning notes for j2-based learning platform (5)

Source: Internet
Author: User

At the beginning, we thought that various concepts, such as the inheritance of java-based classes, were certainly different. It is boring. To
I had a headache when talking about transaction processing before I learned java. Haha.
Haha, I started to study the transaction processing of the MIDlet. In fact, I have never written an Applet before, but the Servlet is much more written,
After all, servlet is also important in MVC. Any servlet must inherit javax. servlet. http. HttpServle
T class, in fact, as a MIDlet is also a concept, all MIDlet must inherit javax. microedition. midlet. MID
Let. To put it bluntly, it inherits the three methods startApp (), pauseApp (), and destoryApp.
After a MIDlet starts running successfully, its lifecycle starts. This lifecycle is completely controlled by JPM. MIDlet
A MIDletStateChangeException is thrown when the status change occurs unexpectedly.
In the entire MIDP specification, transaction processing is divided into high-level transaction processing and low-level transaction processing. Low-level Transaction Processing Based on Different handheld devices
Different class libraries are supported, while Advanced Transaction Processing does not. That is to say, if the MIDlet we do wants to be on different machines
We can only use methods in Advanced Transaction processing instead of calling methods in low-level transaction processing.
In the entire MIDP, transaction processing is formed by a combination of transaction <-> processing methods.
All the components with the display capability of MIDP inherit from the Displayable abstract class, And it derives the Screen
And Canvas (for low-level transaction processing ). There are two interfaces for middle-level Transaction Processing in MIDP: CommandListener and Ite.
MStateListener. The CommandListener interface is often used with the Command class in javax. microedition. lcdui. Yes
Take the following example:
/**
* @ Author You Li
*
* CopyRight (C) 2005
*/
Import javax. microedition. midlet .*;
Import javax. microedition. lcdui .*;
Public class HLEventMIDlet extends MIDlet implements CommandListener {
Private Command exitCommand;
Private Command info1Command;
Private Command info2Command;
Private Display display;
Public HLEventMIDlet (){
Display = Display. getDisplay (this );
ExitCommand = new Command ("exit", Command. SCREEN, 1); // The smaller the number, the higher the priority.
Higher
Info1Command = new Command ("menu 1", Command. SCREEN, 2 );
Info2Command = new Command ("menu 2", Command. SCREEN, 2 );

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.