The first BlackBerry Application of The j2-midlet developer

Source: Internet
Author: User
Tags home screen

For any development, a helloworld introduction is essential. For mobile application development, j2's is also a widely accepted platform technology. First, we use helloworld developed by j2on Blackberry as an example, to start our Blackberry Application Development journey

The first BlackBerry Application of The j2-midlet developer

1. Download and install eclipse and blackberry Java Plug-in for eclipse

The eclipse version used in this article is: Eclipse SDK 3.5.1

The Blackberry Java Plug-in for eclipse version used in this article is: V1.1 (: http://na.blackberry.com/eng/developers/devbetasoftware/javaplugin.jsp)

2. Start eclipse, file à New à other, and select BlackBerry project:

 

 

 

Press finish.

3. Create a package in the src directory of the demo project: Demo

 

4. Create a MIDlet In Demo:

Note:

A) You need to install eclipseme -- Installing via the eclipseme Update site http://eclipseme.org/docs/installEclipseME.html#step2b

B) Another wizard for mobile tools for Java Plug-in for j2's development plug-in cannot create MIDlet www.eclipse.org/dsdp/mtj In the BlackBerry project.

 

 

Press finish.

5. Enter the MIDlet code, for example:

Package demo;

Import javax. microedition. lcdui. Command;

Import javax. microedition. lcdui. display;

Import javax. microedition. lcdui. form;

Import javax. microedition. MIDlet. MIDlet;

Import javax. microedition. MIDlet. midletstatechangeexception;

Public class midlet1 extends MIDlet {

Private form FRM = new form ("Please choose ");

Private display DIS;

Private command cmddel = new command ("edit", command. screen, 1 );

Private command cmdedit = new command ("delete", command. screen, 1 );

Private command cmdexit = new command ("exit", command. screen, 1 );

Private command cmdback = new command ("return", command. Back, 1 );

Public midlet1 (){

}

Protected void Startapp () throws midletstatechangeexception {

Dis = display. getdisplay (this );

Dis. setcurrent (FRM );

FRM. addcommand (mongodel );

FRM. addcommand (cmdedit );

FRM. addcommand (cmdexit );

FRM. addcommand (cmdback );

}

Protected void pauseapp (){

}

Protected void destroyapp (Boolean arg0) throws midletstatechangeexception {

}

}

6. Modify blackberry_app_descriptor.xml in the Red Circle:

Application Type: MIDlet

Name of main MIDlet class: Demo. midlet1 (note that you cannot directly write midlet1)

Application icon: add the icon of the application on the BlackBerry home screen

 

7. Run in the simulator:

 

The running result is as follows:

 

 

8. The demo. COD file is used to install programs on the BlackBerry mobile phone in the eclipse workspace directory.

 

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/salvatore_zhang/archive/2010/05/06/5564186.aspx

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.