Hullo members am developing a cell phone app for my mobile device and I have a java code I have written to do this. I would like any body to help me complete it so that its complete and make the time and date not to disappear after some time. I also want to include a button that pauses as well play the time from the current time. Thanks
Here is the code
import java.util.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class DateTime extends MIDlet implements CommandListener {
private Form form;
private Display display;
private Command pause, resume, exit;
private Timer tm;
private Refresh refresh = new Refresh();
private boolean on = true; // Is 'clock' is running or paused?
public DateTime() {
super();
pause = new Command("Pause", Command.SCREEN, 2);
resume = new Command("Resume", Command.SCREEN, 2);
exit = new Command("Exit", Command.EXIT, 2);
}
public void startApp() {
tm = new Timer();
/* Your first part goes here ...
* create the Form and Timer oblects
* display the current time on the form, and
* add the necessary commands or menu items.
* leave the line above and below intact - they're for the timer
*/
tm.schedule(refresh, 0, 1000);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {
notifyDestroyed();
}
public void commandAction(Command c, Displayable s){
/* Your third and last part is here ...
* implement the command actions
* make sure the commands Pause, Resume, & Exit do the right thing
*/
}
class Refresh extends TimerTask {
public void run(){
if (on) {
/* Here you have the timer implementation for refreshing the screen
* every second to dispay the current time, your second part.
* reload the form with an update of the current time
* note that this function is automatically called every second
*/
}
}
}
}