日期:2014-05-20  浏览次数:20759 次

j2me中的一个怪问题
在使用RecordStore存信息,但在添加完信息,然后遍历时去读出来的是空
遍历代码:
      Comparator   cp=new   Comparator();
        RecordEnumeration   re=rs.enumerateRecords(null,   cp,   true);
        while(re.hasNextElement()){
        byte[]   b=re.nextRecord();
        ByteArrayInputStream   bis=new   ByteArrayInputStream(b);
DataInputStream   dis=new   DataInputStream(bis);
name=dis.readUTF();
sex=dis.readUTF();
age=dis.readUTF();
tel=dis.readUTF();
email=dis.readUTF();
i++;
mf.append( "\n第 "+i+ "条信息:\n ");
mf.append( "\n姓名: "+name);
mf.append( "\n性别: "+sex);
mf.append( "\n年龄: "+age);
mf.append( "\n电话: "+tel);
mf.append( "\n电子邮件: "+email);

//String   temp=new   String(b);
//mf.append(temp);
dis.close();
bis.close();
忘高手不吝赐教
请原谅小弟分数太少,给不起高分,

------解决方案--------------------
最好是在添加以及读取的时候,catch一下,看有没有异常出来
------解决方案--------------------
哦,你把这些都加到了mf中,但你没要求它打印什么呀
------解决方案--------------------
RMS还没用过。