Detailed introduction to the operations of the Android agent

Source: Internet
Author: User

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.

 
 
  1. package cn.edu.buaa.Software;  
  2.  
  3. import javax.microedition.midlet.MIDlet;  
  4. import javax.microedition.midlet.MIDletStateChangeException;  
  5.  
  6. public class MyMidlet extends MIDlet {  
  7.  
  8.     protected void destroyApp(boolean arg0) throws MIDletStateChangeException {  
  9.         // TODO Auto-generated method stub  
  10.  
  11.     }  
  12.  
  13.     protected void pauseApp() {  
  14.         // TODO Auto-generated method stub  
  15.  
  16.     }  
  17.  
  18.     protected void startApp() throws MIDletStateChangeException {  
  19.         // TODO Auto-generated method stub  
  20.  
  21.     }  
  22.  

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.

Related Article

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.