Code:import javax.microedition.lcdui.Display; import javax.microedition.midlet.*; public class Midlet extends MIDlet { Display display; Controller c; public Midlet() { display = Display.getDisplay(this); c = new Controller(this); } public void startApp() { c.setCurrentScreen(c.getCurrentScreen()); } public void pauseApp() {} public void destroyApp(boolean unconditional) { notifyDestroyed(); } }
Code:import javax.microedition.lcdui.Display; public class Controller { Midlet m; Display display; int CurrentScreen = 1; public Controller(Midlet m) { this.m = m; display = m.display; } public int getCurrentScreen() { return CurrentScreen; } public void setCurrentScreen(int screenNumber) { if (screenNumber == 1) { display.setCurrent(new WelcomeScreen()); } } public void checkIfFirstTime() { System.out.println("so far so good"); } }
Apologies for the many lines. Why won't run method go to checkIfFirstTime() method in controller class? i put a print statement above it just to confirm that run is being accessed. the purpose of this app is to first show a welcome screen to the user then it performs a function or two then it goes to another screen. or to sum up, move from one screen to another using a timer. what am i doing wrong?Code:import java.util.Timer; import java.util.TimerTask; import javax.microedition.lcdui.Form; public class WelcomeScreen extends Form { Timer timer; TestTimerTask task; public WelcomeScreen() { super(null); append("Welcome"); timer = new Timer(); task = new TestTimerTask(); timer.schedule(task,1000); } } class TestTimerTask extends TimerTask { Controller c; public final void run() { c.checkIfFirstTime(); } }
Thank you.

Reply With Quote


