Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Save data with RMS

by Retired ‎02-12-2010 02:53 PM - edited ‎09-16-2010 03:16 PM (2,861 Views)



This article applies to the following:

  • BlackBerry® wireless device
  • BlackBerry Java Development Environment (JDE)



The MIDP RMS RecordStore implementation is used to store data persistently on the BlackBerry device. RMS stores data between application instances as well as after device resets. The javax.microedition.rms.RecordStore API is used for this.


The record store class enables you to store byte arrays to a named section of device storage. The data can then be retrieved directly from the record store in byte[] format using the record number (a unique ID given to each record as it is added). Additionally, functionality is provided to create an enumeration of all records in a record store.


To add a record to a RecordStore


RecordStore recordStore = RecordStore.openRecordStore("FILE NAME", true);
int id = recordStore.addRecord(_data.getBytes(), 0, data.length());


To retrieve an enumeration of the RecordStore


RecordStore recordStore = RecordStore.openRecordStore("FILE NAME", false);
RecordEnumeration e = recordStore.enumerateRecords(null, null, false);


Although the RecordStore does not need to be closed until the object is no longer needed, it is good practice to close the RecordStore when you are not using it for an extended time, so that your data is always saved in the event that the program stops responding.

Users Online
Currently online: 18 members 2,621 guests
Please welcome our newest community members: