My J2ME learning course 2

zhaozj2021-02-16  81

J2ME is also Java, so "Think in java" is not two laws (fortunately, it has been read).

The virtual machines VM and J2SE in J2ME, J2EE are different, in J2SE, J2EE, is Classic VM and HotSpot VM, while KVM and CVM, KVM (K Virtual Machine) perform low hardware programs in J2ME, and CVM ( C Virtual Machine) Execute an advanced hardware program. There is also a smart card, huh, take it slowly. (In fact, I don't know why sun is named, C, K mean.)

What is Jini, I have been with a long time. It turns out that he is a Dongdong, a good stuff, a good stuff, a good stuff. . .

What's? CLDC & CDC? Connected Limited Device Configuration (CLDC); CONNECTED Device Configuration (CDC); CLDC is included in CDC, huh, is a connection configuration

MIDP? This thing is very important, what is the stuff? Mobile Information Device Profile, one of the two configurations of CLDC, the other is PDAPROFILE, which is for PDA configuration, now popular MIDP, or 2.0, because we have written mobile games less, it is our development game device configuration standard.

MIDET will also see that is the MIDP application MIDP Application..

Let's take a look at the hardware standard of MIDP.

MIDP:

RAM and ROM: At least 512K

Power supply: Usually used battery, limited power supply

Network connection capability: wireless communication capabilities with low frequency width

There is an additional RAM or ROM supply to perform and store information

Let's take a look at the MIDP. (Find a Nokia's MIDP2.0 English Data)

MIDP limit:

MIDP is the standard set for mobile phones such as mobile phones, so the restriction is less.

1. CLDC 1.0 does not support floating point operations, such as float and double, if you want to use floating point operations, you can only save or integer array

2. Class Loader is not designed in MIDP, you need to load the class manually

3. There is no recycling Finalization, the object must be manually released before deleting

4. There is no Java Native Interface (JNI), but it doesn't mean. Because J2ME's code is generally dealing with J2SE, J2EE code.

5. The mapping Reflection does not support the serialization of RMI and objects of Object Serialization.

6. Error handling is very wasting resources, so there is only 3 error classes in J2ME: java.lang.Error,

Java.lang.OutofMemoryError, java.lang.virtualmachineerror.

7. Swing AWT is very cumbersome, so MIDP provides specialized high-level user interface HIGH-Level User Interfaces

8. There is no read and write interface for the continuous file of the device file system, and instead of the Record Management System (RMS).

9. MIDP supports multithreading, but does not support thread groups and daemon DAEMON Thread, which can replace thread groups in the application layer. MIDP can be implemented:

1. The core Java class library of MIDP consists of two parts, part of J2SE, part of the J2ME is designed separately.

In the class library, in addition to Object, Class, Runnable, String, System, Thread, throwable, the data type in Math, in Java.lang, in addition to the data type of the floating point operation, Java.util STACK, Vector, Hashtable,, Random, Enumeration (not reserved for iTerator), most of Java.IO can be found in J2ME.

2. MIDP has a special Display object that controls the connection of the input device and the display device, and the Display object only allows one time. Displayable is a container that provides all user visual interfaces, with two subclasses, canvas and screen. CANVAS Controls Pixel Display and Low-level Interface features, SCREEN provides high-level interface features such as selection menu and data forms.

3. High-level user interface HIGH-Level User Interfaces

FORM is inheriting the SCREEN class, a container that places the interface. In fact, everyone has used Swing to know what is, Form seems to be a name from Delphi. The interface components are:? ChoiceGroup,? Textfield,? Datefield,? Gauge, Image, MIDP2.0 Added Spacer, StringItem, CustomItem, etc., as the Dongdong, everyone, look at the help documentation is OK.

4. Canvas Canvas

Used to control the underlying to display the movement and dynamic images in the game, you can interchange it with Screen. The Canvas class must inherit the call, and he provides a Paint () method to draw or refresh, and provide many other methods to draw graphics, text, etc., support the PNG format.

When the game is developed, an improved GameCanvas class is found, inheriting from Canvas, providing a number of ways to develop games.

5. New game API javax.microedition.lcdui.game.

MDIP2.0's new game API provides methods commonly used in Tiled Backgrounds in Sprites. Sprite Layerl is the surface layer in the game, which is used to complete the movie of the picture, while Tilelayer can provide the background layer of the game. These are all completed by the layer manager LayerManage, and this mechanism can achieve the redrawing of the new layer and the old layer has dimmed.

In addition, GameCanvas provides a buffering speed and unflashing animation, and the flushgraphics () method is used to copy the images in the buffer to the screen, so that the double buffer is not flashing without having to write itself.

The getKeyStates () method is also new, used to determine the device buttons, it seems that the combined key is, it is a blessing, we can make a combination of great tricks.

6. RGB image

Public void Drawrgb (int [] RGBData, int Offset, int Scanlength, Int x,

Int Y, Int Width, Int Height, Boolean Processalpha

MDIP 2.0 supports users to access images in an integer array, so that this method is used to transform in the pixel level.

7. Respond to Commands

All interactive moves are inseparable from Commands, what a button indicates, such as opening, close, exiting. . .

Give everyone a code to know what it is.

Class Myclass Implements CommandListener {

Public void CommandAction (Command C, Displayable S) {

Forum.noif (c == back_cmd) {...}

}

}

Only in J2ME, Command is abstract.

Command back_cmd = new command ("back", command.back, 1);

MyScreen.AddCommand (back_cmd);

8. MIDP 2.0 Media API audience API Javax.Microedition.media

Just support sound, video and images are not supported, generally .wav files, MIDP 2.0 just specifies demand for sound quality

9. MIDP2.0 expands the way network connection, not only HTTP, adds Secure HTTP (HTTPS), advocating User DataGram Protocol (UDP), direct TCP connection, and serial communication Serial Port Communication.

The CLDC provides a general connection platform Generic Connection Framework (GCF), and he uses all external data to be abstract into a Connector class, for example to open a web connection .open (http://www.forum.nokia.com);

Open a Socket connection

Connector.open (socket: //forum.nokia.com: 9001);

10. Google Architecture Push Architecture

In fact, the stack structure is useful in the war with the game, but it also looks at whether the equipment is supported.

11. Timer and alarm Timer & Alerts

Timer class is running for the back-off thread, which is the same as J2SE.

Alert is a special Screen object that displays text and images and is automatically stopped after a period of time. If the time interval is set to Forever, the device automatically provides a method to eliminate Alert.alert is generally used to display an error message.

12. Record Management System Record Management System (RMS)

This mentioned earlier, he replaces the read and write of data for the file system of permanent data in the IO system, such as access game archive, high score, etc.

MIDlets allows multiple storage records to be established with different file names and can be recorded in different MIDlets in the same kit. If the external condition allows, the MIDlets record that sets different kits can also be exchanged.

13. Terminal to the terminal security protocol HTTPS? End-to-end security - https

In addition to security protection based on MIDlet layers, MIDP2.0 provides additional communications via HTTPS (Secure HTTP) for end users. HTTPS is used in the fields of online banking services, and is protected by providing a dedicated HTTP security channel. TRANSPORT LAYER Security (TLS) or Secure Sockets Layer (SSL) technology is typically implemented on the HTTP protocol. .

14. Hosting MIDLET components

A marked MIDLET component ensures that the content of the user's MDILET component is not tampered with and the source of the MIDlet component is legal or can be authenticated. MIDP2.0 implements the signature of the developer on the device. It seems that it is a bit around, but it means that MIDP 2.0 provides a genuine verification mechanism.

I am tired, I have a unclear today, but a lot of things should be slowly understood, slowly come, and the gains every day is the biggest gain.

转载请注明原文地址:https://www.9cbs.com/read-14883.html

New Post(0)