Study Notes on j2-based learning platform (III)

Source: Internet
Author: User

From today on, I think I will not involve real development for a long time. This period of time is mainly focused on basic learning.
. Oh, no. How can I run it? But it is mainly because you don't have to rush to give your brother something for the moment, so you want to study it well. No
I will certainly write some code. After all, you can learn faster by writing more code.
Haha, the journey of Mobile Phone development has been started step by step. I don't know if I can finish learning this part because the company is under a lot of pressure.
Large. There is basically no rest at ordinary times, and there is still a bunch of things to do on weekends. So it is also a bitter aspect. Haha. Try your best. I
Direct web application is not a solution. You may need to learn more. After all, handheld devices are a future trend.
I used sun's official MIDP instance when I was studying. You can go down on your own. I chose MIDP_2.0 reference source code.

To write a MIDlet, perform the following steps on the actual device or simulator:
1. Write Program code
2. Compile
3. Pre-approval (Preverify) is very important because J2SE support is installed on many types of PCs, but the actual J2SE does not support
Hold.
4. Write Descriptive documents
5. Merge JAR files
6. Test troubleshooting
7. Run on the simulator or physical machine.

OK

Let me start to write a simple example, which completes the final seven steps from the beginning of code writing. (This example is based on MIDP_2.
Some interfaces have been defined in "0", so I put this program under the MIDP root directory I extracted: f: midp .)
Step 1: write the code:
Import javax. microedition. midlet .*;
Import javax. microedition. lcdui .*;
Public class HelloMIDlet extends MIDlet implements CommandListener {
Private Command exitCommand;
Private Display display;
Public HelloMIDlet (){
Display = Display. getDisplay (this );
ExitCommand = new Command ("Exit", Command. SCREEN, 2 );
}
Public void startApp (){
TextBox t = new TextBox ("Hello MIDlet", "Test string", 256, 0 );
T. addCommand (exitCommand );
T. setCommandListener (this );
Display. setCurrent (t );
}
Public void pauseApp (){}
Public void destroyApp (boolean unconditional ){}
Public void commandAction (Command c, Displayable s ){
If (c = exitCommand ){
DestroyApp (false );

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.