J2ME Program Development Novice Introduction nine major points

Source: Internet
Author: User
Tags exception handling file size interface thread
Java Basics needed in program one, J2ME

Now a lot of people, are starting from zero to learn j2me, learning J2ME, always from the Java Foundation to learn, and now speak Java based books are based on J2SE, which caused some unnecessary trouble learning, The following is a simple description of the Java basics that are used in J2ME and that are not needed.

Java basics to use in J2ME:

1. Java Syntax basics: including basic data types, keywords, operators, and so on

2. Object-oriented thinking: Concepts of classes and objects, inheritance and polymorphism, and so on.

3. Exception Handling

4, multithreading

Java basics not used in J2ME:

1. Use of Javac and Java commands in JDK

2, many of the classes in the Java Foundation are not in J2ME, or the methods in the class do a lot of streamlining. Therefore, it is recommended to be familiar with class libraries in J2ME.

3, applets, AWT, swing these knowledge in the J2ME is not used.

Simply say so much, hope to learn J2ME friends can take a few detours, the shortcomings of the hope that we will actively correct and add.

Second, temporarily unable to complete the function in the J2ME

Some of the J2ME in the temporary function can not be completed, I hope you can actively add:

1, in the mobile phone does not change the code to implement the transplant, mainly refers to the game.

2, dynamically modify the button text.

3. Accept Chinese input on canvas.

4, the operation of local resources, such as address Book, received messages and so on.

5, the production of destructive mobile phone virus.

6, other waiting for everyone to add.

Three, J2ME of the cross-platform nature

J2ME technology originated in Java, so it also has the advantage of the JVM, can be on the Java-enabled platform for porting, but now the J2ME technology on the Cross-platform is bad, let's take a quick look at the reason:

1, mobile phone screen size is different:

This is mainly in the interface production. If you are using the advanced user interface, such as you do is the application development or user login, user registration, such as general functions, generally no problem.

If you're using a low-level user interface, like you're playing a game, then you need to think about it.

2, the vendor's expansion API is not uniform:

Nokia's extended API Class Library UI series, for example, is not implemented on other phones, or has a different package name and so on.

3, the mobile phone platform to achieve the bug:

For example, Nokia 7650 has bugs in implementing double buffering, so software running on this model cannot use double buffering. Some of the other bugs on Nokia are as follows: http://blog.csdn.net/Mailbomb/archive/2005/03/24/329123.aspx

4, mobile phone performance problems.

The available memory for different handsets, the largest jar files are required, such as Nokia S40 most mobile phone support for the largest jar file is 64K, the maximum available content is 210K.

So now the mobile phone software, especially the game is to provide support for the list of models, but also the existence of mobile game transplant personnel.

Iv. learning the types of work that J2ME can engage in

Now J2ME technology can be said to be quite hot, here are some learn the J2ME can be engaged after the kind of work:

1, J2ME Game developers

According to the game planning or documentation requirements, in a specific model (Nokia S40 or S60 majority) to develop the game program. This is the work that most J2ME programmers are doing now.

Need to master: Advanced user interface, low-level user interface, thread, if it is a network game, also need skilled network programming.

2, J2ME application developers

Today's mobile apps are not many, but there are some, especially mobile positioning and mobile business-related content. Need to be proficient: Advanced user interface, threading and network programming.

3, J2ME game transplant personnel

By referencing the source code, games that can be run on one platform are ported to other platforms. For example, porting the Nokia S40 game to S60, or Sony Ericsson's T618 and so on. The main control screen coordinates, some may need to replace some APIs.

Need to be familiar with the differences between the platforms and related technical parameters, such as screen size, maximum jar file size, and so on.

Five Principles of J2ME programming

1, the use of object-oriented programming.

Although you can reduce the size of your files by using process-oriented programming, you will need to use object-oriented programming in order to maintain convenience and scalability later.

2. Use MVC pattern

Separates the model, interface, and control. Many programs now combine the three, but if you do a larger number of programs, it is advisable to separate them.

3, automatic storage user settings

Use RMS to store user information, such as storing user names, passwords, and user preferences for the user's last entry, so as not only to reduce user input, but also to be user-friendly. Many programs even do the automatic landing and so on.

4, some system settings allow users to close. such as background music, background light display.

5, the low-level user interface to draw the action in a separate thread inside.

6, in need of a lot of time to complete the work, give the user a waiting interface.

Six, from the simulator to the real machine test

For J2ME developers, the simulator has brought us a lot of convenience, such as the debugger in the simulator and very convenient to see the effect of the program, but the simulator also brought us some problems, such as the emulator implementation of bugs and so on, so the real machine test is necessary.

1. Why do I have to do the real machine test?

Because of the possible bugs in the emulator program and the limited performance of the real machine, a true machine test is required.

2, how to transfer the program to the machine?

The way to transfer programs to machines is as follows:

a) Ota download

b) Use of data line transport

c) Infrared transmission

d) Bluetooth

You can choose the right way according to the conditions.

3, the real machine test what is the main measure?

The real machine test content is many, the main test the following aspects:

A) The function of the program

b The operation of the program is easy to operate

c the size of the program, such as the Nokia S40 series of mobile phones most accept the largest file size of 64K

d The program is running at a speed that can be tolerated.

Seven, from WTK to the manufacturer SDK

For J2ME enthusiasts, basically we all start from Sun WTK (J2ME Wireless Toolkit), but for practical applications, just use WTK is not enough, so in the learning process, must complete from the WTK to the SDK leap.

1, the Manufacturer SDK download address?

· Nokia

Nokia is worthy of the mobile phone industry's boss, for J2ME support is also first-class, there is a dedicated website to provide SDK and a variety of document descriptions.

The Web site is: http://forum.nokia.com.cn/sch/index.html

· Siemens

Siemens also has a good support for J2ME, which provides an SDK that the emulator needs to be installed independently. The download address is as follows:

   https://communication-market.siemens.de/portal/main.aspx? Langid=0&mainmenuid=2&leftid=2&pid=1&cid=0&tid=3000&xid=0

· SonyEricsson

SonyEricsson SDK and its own simulator, download the address is:

   http://developer.sonyericsson.com/site/global/docstools/java/p_java.jsp
   http://mobilityworld.ericsson.com.cn/development/download_hit.asp

· Motorola

Motorola provides a dedicated SDK with an internal simulator, with the download address:

   http://www.motocoder.com/motorola/pcsHome.jsp

· SamSung

Samsung also provides a dedicated SDK and simulator, with the download address:

   http://developer.samsungmobile.com/eng/front_zone/bbs/bbs_main.jsp?p_menu_id=1500

· Nec:

NEC also provides an SDK for the integrated emulator, with the following download address:

   HTTP://WWW.NEC-MFRIEND.COM/CN

2, the manufacturer SDK and WTK What is the difference?

The simplest understanding of the Vendor SDK is to add its own emulator and its own extension API on a WTK basis. That is, when you use the vendor's SDK, you can use the vendor's extended class library, such as Nokia's UI class library, and the manufacturer's own simulator. There are not many extension APIs for each vendor, and they are different.

3, how to use?

Some vendor SDK uses are the same as WTK, such as Samsung. Nokia provides a separate interface for development, but this interface is not used in actual development.

4, the Manufacturer SDK problem

During the Vendor SDK implementation, there are some bugs that are inconsistent with the true machine implementations. For example, Nokia's mix playback problem and so on.

Eight, the method that obtains the handset IMEI in the J2ME

IMEI is the internation mobile entity identification abbreviation, input * #06 # in the mobile phone can display the number, length of 15 bits, the world's only, never conflict, so can be used as a symbol to identify users.

Here's how to get the IMEI in J2ME:

1, the Moto series of mobile phones can read the system's IMEI property obtained, the code is as follows:

String IMEI = System.getproperty ("IMEI");

2, Siemens series of mobile phones can be read by the Com.siemens.IMEI properties of the system, the code is as follows:

String IMEI = System.getproperty ("Com.siemens.IMEI");

Ix. J2ME solution to display problems in network connection

In the network programming, some time will appear some in did not receive the network data to display the interface, causes the interface to display does not meet the request (for example, the announcement display, will display the announcement the background picture again to display the bulletin information), here proposed a simple solution to everybody:

The way to resolve this situation is divided into three steps:

1, in the need to display the interface, call the method of sending network data. This constructor is invoked each time the display is displayed, without invoking the display's Setcurrent method.

2, display waiting interface (such as progress bar, etc.), to the user prompts, in the network connection.

3. After processing the data of the network feedback, the Setcurrent method called display displays the current interface.

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.