Why do we need to launch the Android j2s program? What makes these users like Google's operating system? Some people say it is comparable to the iPhone? These questions are a good thing for people who want to know about Android smartphones and Google.
First of all, everyone who has used Eclipse to write Android and Android j2's programs knows that Eclips can quickly create a program through a template, so we will start from creating two simple applications, one is j2's and the other is Android's.
The Android agent program is as follows:
To run the two programs, there must be a child class of MIDlet for j2_m2. for Android, there must be a child class of Activity. In a sense, these two classes are functionally the same, and they are extremely similar in terms of lifecycles.
- package cn.edu.buaa.Software;
-
- import javax.microedition.midlet.MIDlet;
- import javax.microedition.midlet.MIDletStateChangeException;
-
- public class MyMidlet extends MIDlet {
-
- protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
- // TODO Auto-generated method stub
-
- }
-
- protected void pauseApp() {
- // TODO Auto-generated method stub
-
- }
-
- protected void startApp() throws MIDletStateChangeException {
- // TODO Auto-generated method stub
-
- }
-
- }
The MIDlet of Android j2's program is relatively simple. Only startApp (), pauseApp (), and destroyApp (boolean arg) methods are used for load, pause, and exit, but it does in simple applications ).
Through the above comparison, we can see that google does not go beyond the Android j2s in terms of concept, but it is very valuable to make its functions more powerful ). The specific usage of these two classes is not described here. It is more convenient to go to the official API documentation or sample code. These two classes are enough to make the program run normally, but programs without the UI are meaningless to users, next time, I will make a preliminary comparison of the UI presentation of Android and j2's.