• April 27, 2024, 03:08:48 pm

Author Topic: Timestamp -> Calendar (Timecard)  (Read 1986 times)

0 Members and 1 Guest are viewing this topic.

Offline Nick99

  • Viewer
  • *
  • Posts: 4
  • Reputation: 0
  • Symbian Power User
  • Current Phone: : Nokia 6303i
Timestamp -> Calendar (Timecard)
« 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
« Last Edit: February 02, 2013, 01:12:57 pm by Nick99 »

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: Timestamp -> Calendar (Timecard)
« Reply #1 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.

Offline Nick99

  • Viewer
  • *
  • Posts: 4
  • Reputation: 0
  • Symbian Power User
  • Current Phone: : Nokia 6303i
Re: Timestamp -> Calendar (Timecard)
« Reply #2 on: February 02, 2013, 01:05:03 am »
No clue

Offline Nick99

  • Viewer
  • *
  • Posts: 4
  • Reputation: 0
  • Symbian Power User
  • Current Phone: : Nokia 6303i
Re: Timestamp -> Calendar (Timecard)
« Reply #3 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