简体   繁体   English

RecordStore中的J2ME记录删除问题

[英]J2ME Record deletion problem in RecordStore

I am using a recordstore to store some data,and each data is being shown in form of list elements.In my application,i am having a feature in which i can delete a particular list element.When i perform this action,item is getting deleted from the list but it is not working with the record. 我正在使用一个记录存储来存储一些数据,并且每个数据都以列表元素的形式显示。在我的应用程序中,我具有一个可以删除特定列表元素的功能。执行此操作时,项目从列表中删除,但不适用于该记录。 I dont know why? 我不知道为什么? Can any one help me? 谁能帮我? My code snippet is: 我的代码段是:

int x=list.getSelectedIndex();
             list.delete(x);
             try
             {
                rs_store.deleteRecord(x);
             }
             catch(Exception error)
             {
                 System.out.print("error");
             }

display.setCurrent(list);

Thanks in advance 提前致谢

If the indices of the items in your List are supposed to correspond with the indices of items in your RecordStore , then your problem may be down to the fact that RecordStore entries are 1-based, not 0-based. 如果您List中项目的索引应该与RecordStore中项目的索引相对应,则您的问题可能归结于RecordStore条目基于1而不是基于0的事实。

So element 0 in your list will correspond to record 1 etc. 因此,列表中的元素0将对应于记录1等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM