Do you know the differences between the two android platforms? Here we will share with you how to port the two game servers to the Android platform. If you are a game developer of the two platforms, I believe this article will help you to quickly migrate some j2s games to the Android platform.
Differences between j2s and android
This article mainly introduces how to port a j2-based game to the Android platform. If you are a game developer and want to quickly migrate some j2-based games to the Android platform, I believe this article will help you. Of course, if you can install a JVM for implementation, you can skip this article.
1. Platform comparison
J2EE: Development Platform
Android: Operating System
2. Compare source code, resource folders, images, and data of the project structure)
J2EE:
Res: resource file
Src: source code
Android:
Src: source code
Res \ drawable: Image
Res \ raw: Sound
Res \ values: String
Assets: data files
3. Comparison of installation packages
J2-jad, jar
Android: apk
4. code structure comparison
Corner Stone: MIDlet, Canvas
Android: Activity, View
All adopt the inheritance method, and each has only one MIDlet/Activity, generally only one Canvas/View
◆ To sum up, there are the following differences:
Connections in j2s are opened from Connector, while those in Android are opened from URL objects.
To set whether the connection can be read and written, you can directly set the connection in J2ME ctor. Open. In Android, you must use the setDoInput (boolean) and setDoOutput (boolean) Methods to set the connection.
You can use J2ME ctor. set connection timeout in Open mode. In Android, you can use setConnectTimeout (int) to not only set connection timeout, but also set timeout. If the parameter is set to 0, the connection timeout is ignored.
When using these APIs, you must pay attention to the significance of each parameter. For example, the last two parameters of drawRect in j2s are width and height, while in Android, they are the coordinates of the end point, do not arbitrarily pass parameters when using them.
For the definition of the Override method, do not forget the super. Method for callback.
The above basically compares the APIS commonly used in the development of 2D game games by Using J2EE and Android. After learning about these APIs, basically, it is easier to migrate ME game smoothly to the Android platform. Of course, this is only for games. If you want to migrate a j2-based software to the Android platform, this method is not applicable. You need to learn how to use the android control.