Hi ...
i got it. It is working.
I had to add "Manifest-Version: 1.0" manually to the jad file.
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
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