The Main
class is the MIDlet main class. When
the MIDlet is launched, the Main
class is loaded
first.
To implement the Main
class:
Create the Main.java class file.
package com.nokia.example.nnaclientexample;
Import the required classes and packages.
import javax.microedition.lcdui.Display; import javax.microedition.midlet.MIDlet;
Create the Main
class to extend the MIDlet.
The Main
class owns the object of the MainView
(UI class).
public class Main extends MIDlet { private MainView mainView;
Create the Main
class constructor.
public Main() { }
Define the mandatory lifecycle methods for starting, pausing, and destroying the MIDlet.
public void startApp() { mainView = new MainView(this); Display.getDisplay(this).setCurrent(mainView); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void quit() { destroyApp(true); notifyDestroyed(); } }
Now that you have implemented the MIDlet Main
class,
implement the MIDlet MainView
class.