Symbian-Developers

The Official Developers Section => Symbian Software Development Discussions => The Developers Section => Symbian Java/C++ Application Development => Topic started by: Nick99 on February 01, 2013, 11:59:32 pm

Title: Timestamp -> Calendar (Timecard)
Post by: Nick99 on February 01, 2013, 11:59:32 pm
Hi ...

i got it. It is working.

I had to add "Manifest-Version: 1.0" manually to the jad file.

Code: [Select]
MIDlet-1: Timestamp,,TimestampMIDlet
MIDlet-Jar-Size: 1935
MIDlet-Jar-URL: Timestamp.jar
MIDlet-Name: Timestamp
MIDlet-Vendor: unknown
MIDlet-Version: 1.0
Manifest-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-2.1

Code: [Select]
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import java.util.Date;
import java.util.Calendar;
import javax.microedition.pim.*;

public class TimestampMIDlet extends MIDlet {

public TimestampMIDlet() {
}

public void destroyApp(boolean arg0) throws MIDletStateChangeException {
}

public void pauseApp() {
}

public void startApp() throws MIDletStateChangeException {
        EventList eventList = null;
       
        Date mytime = new Date(System.currentTimeMillis());
        Calendar mycalendar = Calendar.getInstance();
        mycalendar.setTime(mytime);
       
        String mysummary = null;
       
        if (mycalendar.get(Calendar.AM_PM) == 0) {
        mysummary = "check in";
        } else {
        mysummary = "check out";
        }

try {
            PIM pim = PIM.getInstance();
            String listNames[] = pim.listPIMLists(PIM.EVENT_LIST);
            if (listNames.length > 0) {
                eventList = (EventList) pim.openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE, listNames[0]);
                Event newEvent = eventList.createEvent();
                if (eventList.isSupportedField(Event.SUMMARY)) {
                    newEvent.addString(Event.SUMMARY, PIMItem.ATTR_NONE, mysummary);
                }
                if (eventList.isSupportedField(Event.START)) {
                    newEvent.addDate(Event.START, PIMItem.ATTR_NONE, mytime.getTime()); //
                }
                if (eventList.isSupportedField(Event.END)) {
                    newEvent.addDate(Event.END, PIMItem.ATTR_NONE, mytime.getTime()+60000);
                }
                eventList.importEvent(newEvent);
                newEvent.commit();
            }

        } catch (PIMException e) {
} finally {
            try {
                if (eventList != null) {
                    eventList.close();
               
                }
                destroyApp(false);
                notifyDestroyed();
            } catch (PIMException e) {
            }
        }
}
}

Bye Nick
Title: Re: Timestamp -> Calendar (Timecard)
Post by: Allstar12345 on February 02, 2013, 12:47:39 am
You sure it packed right ?
I'm not good in pure java but it looks fine from here.
Title: Re: Timestamp -> Calendar (Timecard)
Post by: Nick99 on February 02, 2013, 01:05:03 am
No clue
Title: Re: Timestamp -> Calendar (Timecard)
Post by: Nick99 on February 02, 2013, 01:15:06 pm
Hi ...

its working. I had to add "Manifest-Version: 1.0" manually to the jad file.

I updated the top posting.

Is there a way to run the app as trusted without spending $200 on a keystore?

Bye Nick