×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    2

    DateField time problem on Nokia 3220 (Series 40)

    I'm having problems with a DateField where the time is not reflected properly. It happens on both the S40 emulator and on the actual phone. I print out the value of the DateField time when I activate a menu command, however the value does not correspond with that in the DateField input box when I put 00 in the hours field or 00 in the date field after that number was previously not a 00. Try the following sequence with the code below
    1. Set time to 01:23 and click 'Show'. Displays fine
    2. Change minutes to 00 and click 'Show'. Still displays 01:23
    2. Change minutes to 05 and click 'Show'. Displays 01:05
    3. Change hours to 00 and click 'Show'. Still Displays 01:05
    4. Change hours to 02 and click 'Show'. Displays 02:05

    It seems to occur when I change only 1 field to 00. Is there any work arounds?
    Code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.util.Date;
    import java.util.Calendar;
    
    public class Midlet  extends MIDlet implements CommandListener
    {
        private final static Command CMD_EXIT = new Command("Exit", Command.EXIT, 
                                                            1);
        private Command show = new Command("Show", Command.SCREEN, 1);
        private StringItem msg = new StringItem("","");
        private DateField time = new DateField("Time", DateField.TIME);
        private boolean firstTime;
        
        private Form mainForm;
        
        public Midlet() {
            firstTime = true;
            mainForm = new Form("Alert Options");
            time.setDate(new Date());        
        }                                                        
                                                            
        protected void startApp() {
                if (firstTime) {
                    mainForm.append(time);
                    mainForm.append(msg);
                    mainForm.addCommand(show);
                    mainForm.addCommand(CMD_EXIT);
                    mainForm.setCommandListener(this);  
                    firstTime = false;
                }
            Display.getDisplay(this).setCurrent(mainForm);
        }    
    
        protected void destroyApp(boolean unconditional) {
        }    
    
        protected void pauseApp() {
        }   
        
        public void commandAction(Command c, Displayable d) {
            if (c == CMD_EXIT) {
                destroyApp(false);
                notifyDestroyed();
            }
            else if (c == show)
            {
                String tmp;
                Calendar cal = Calendar.getInstance();;
                cal.setTime(time.getDate());
                tmp = "";
                tmp +=  cal.get(Calendar.DATE) + "/" +
                        cal.get(Calendar.MONTH) + "/" +
                        cal.get(Calendar.YEAR) + " " +
                        cal.get(Calendar.HOUR) + ":" +
                        cal.get(Calendar.MINUTE) + "_" +
                        cal.get(Calendar.AM_PM) + "\n";
                tmp += time.getDate();
                msg.setText(tmp);
            }
        }    
    }
    Last edited by TheWheat; 2006-03-29 at 21:24.

Similar Threads

  1. Python for Series 60 released on Forum Nokia!
    By eriksmartt in forum Symbian
    Replies: 5
    Last Post: 2009-07-14, 17:00
  2. Nokia enhancement drivers for Series 60 (Nokia 6620) phones.
    By stroget in forum General Development Questions
    Replies: 1
    Last Post: 2005-03-09, 09:23
  3. Nokia Series 40 and 60 Internal Modem
    By gdina1001 in forum Mobile Java General
    Replies: 1
    Last Post: 2004-04-22, 09:20
  4. Nokia Comunicator 9500
    By alvisone in forum General Development Questions
    Replies: 2
    Last Post: 2004-03-01, 07:01
  5. Series 60 Concept Emulator (SDK Beta 0.2 Linux) not working
    By mattbee in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2003-06-10, 11:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×