Hi , I'm making a diary appointment application where user can set the time&date which will be stored , updated , and deleted using RMS.
However , when i run the program it launch an exceptions that appears that
the record ID not detected , when i check the program I can't find anything wrong with it
Here is the code that read the recordstore,
rs = RecordStore.openRecordStore("myappt", true);
for(int j=1;j<=rs.getNumRecords();j++){
name=new
String("");
at=new String("");
bais=new ByteArrayInputStream(rs.getRecord(j));
dis=new DataInputStream(bais);
str=dis.readUTF();
if(!(str.startsWith("@"))){
for(int i=0;i<str.length();i++){
if(Character.isDigit(str.charAt(i)))
at += str.charAt(i);
else
name+=str.charAt(i);
}
}
long time=0;
String setAt;
if(!(at.trim().equals("")))
{
time = Long.parseLong(at);
java.util.Date date = new java.util.Date(time);
java.util.Calendar rightnow = java.util.Calendar.getInstance();
rightnow.setTime(date);
String year = String.valueOf(rightnow.YEAR);
String month = String.valueOf(rightnow.MONTH);
String day = String.valueOf(rightnow.DATE);
String am = "";
if (rightnow.get(java.util.Calendar.AM_PM) == 0)
am = "PM";
else if (rightnow.get(java.util.Calendar.AM_PM) == 1)
am = "AM";
String hr = String.valueOf(java.util.Calendar.HOUR);
String min = String.valueOf(java.util.Calendar.MINUTE);
setAt = name + "" + day + "/" + month + "/" + year + "" + hr + ":" +
min + "" + am + "";
}
else
{
setAt = name;
}
list.append(str,null);
list.append(setAt,null);
cg.append(setAt,null);
//cg.append(str,null);
name=new String("");
at=new String("");
}
And here is the exceptions occured,
javax.microedition.rms.InvalidRecordIDException
at javax.microedition.rms.RecordStore.findRecord(+86)
at javax.microedition.rms.RecordStore.getRecord(+22)
at dbstreaming.Appointment.getAppointment(+73)
at dbstreaming.Appointment.<init>(+176)
at java.lang.Class.runCustomCode(+0)
at com.sun.midp.midlet.MIDletState.createMIDlet(+19)
at com.sun.midp.midlet.Selector.run(+22)
It was once able to display the choicegroups with null value, but after that it only throws exceptions .
Anyone can help?
cheers
paula