Time for action - accessing the PersistentObject data

  1. Modify the code you just added to add the call to setContents in the if statement to match the following code.
    if (JournalStoreObject.getContents() == null)
    _EntryList = new Vector();
    _EntryList = (Vector)JournalStoreObject.getContents();
  2. Next, add the call to commit to the onClose method.

What just happened?

These two calls are all that is needed to save your data to the PersistentStore. The call to the commit method was placed into the onClose method because we want to save the data when the application exits, but it doesn't have to be. You may have a good reason to call the commit method in the middle of your ...

Get BlackBerry Java Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.