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

Storing persistent data

by BlackBerry Development Advisor ‎02-12-2010 12:59 PM - edited ‎09-17-2010 04:32 PM (18,771 Views)



Write an application that stores and uses persistent data.



  • Discover how to store data for an application.
  • Discover how to create objects that can persist.
  • Discover how to save and retrieve data.


  1. Extract music_stores_incomplete.zip
  2. In the IDE, open the music_stores.jdw workspace
  3. Open the MusicStores.java source file.


  1. In the static initializer, retrieve a reference to a PersistentObject using the store variable.
  2. In the synchronized block, if the PersistentObject is empty, set its contents to a new Vector.
  3. Retrieve PersistentObject contents and store it in a Vector.
    TIP: Use the _data variable already defined.
  4. Add code to the StoreInfo inner class to define an object that can persist. TIP: Each object stores information about one music store.
  5. Add code to saveItem to create a Save menu item that saves the music store information that users have entered.
  6. Add code to getItem to create a Get menu item that retrieves and displays data from the last music store that was added.

Check Your Work


(from music_store_complete.zip)



In this exercise, you discovered the following things:

  • how to create a data storage area for an application
  • how to create a new type of object that can persist
  • how to retrieve data from a persistent data store
  • how to add data to a persistent data store
Users Online
Currently online: 38 members 2,644 guests
Please welcome our newest community members: