Retrieve all records from a record store

  1. Import the required classes and interfaces.
    import javax.microedition.rms.RecordComparator;
    import javax.microedition.rms.RecordEnumeration;
    import javax.microedition.rms.RecordFilter;
    import javax.microedition.rms.RecordStore;
  2. Invoke openRecordStore().
  3. Invoke enumerateRecords(). Pass the following parameters:
    • filter: specifies a RecordFilter object to retrieve a subset of record store records (if null, the method returns all records)
    • comparator: specifies a RecordComparator object to determine the order in which the method returns the records (if null, the method returns the records in any order)
    • keepUpdated: determines if the method keeps the enumeration current with the changes to the record store
    RecordStore store = RecordStore.openRecordStore("Contacts", false);
    RecordEnumeration e = store.enumerateRecords(null, null, false);

Was this information helpful? Send us your comments.