Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Midlet Lifecycle 
 

By default Midlet is in the paused states. when the application is executed by default startApp() method will call and when close the application the destroyApp() method will be called.

 

Midlet Lifecycle

                         

A MIDlet lifecycle have following steps...

  • startApp()
  • pauseApp()
  • destroyApp()

By default MIDlet is in the paused states. when the application is executed by default startApp() method will call and when close the application the destroyApp() method will be called. But when your constructor is not null type then it will be executed firstly. The source code of life cycle execution is as follows:

 

 

 

import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;

public class MidletLifecycle extends MIDlet{
  private Form form;
  
  private Display display;

  public MidletLifecycle(){
    System.out.println("MidletLifecycle constructure");
  }

  public void startApp(){
    form = new Form("Midlet Lifecycle");
    display = Display.getDisplay(this);
    String msg = "This is the Lifecycle of Midlet!";
    form.append(msg);
    display.setCurrent(form);
  }

  public void pauseApp(){
    System.out.println("You are in pauseApp()...");
  }

  public void destroyApp(boolean destroy){
    System.out.println("You are in destroyApp()...");
    notifyDestroyed();
  }
}

 

Fig: MIDlet Lifecycle

Output:

Download Source Code

                         

» View all related tutorials
Related Tags: c j2me diff types type if example to rectangle draw exam raw angle e il pe in different m nt

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.