J2ME Record deletion problem in RecordStore

497 views Asked by At

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

1

There are 1 answers

2
funkybro On

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.

So element 0 in your list will correspond to record 1 etc.