Retrieve persistent data

  1. Import the required classes and interfaces.
    import net.rim.device.api.system.PersistentObject;
    import net.rim.device.api.ui.component.Dialog;
  2. Invoke getContents() on a PersistentObject.
  3. To convert to your desired format, perform an explicit cast on the object that PersistentObject.getContents() returns.
    synchronized(store) {
    String[] currentinfo = (String[])store.getContents(); 
    if(currentinfo == null) {
    Dialog.alert(_resources.getString(APP_ERROR));
    } 
    else {
    currentusernamefield.setText(currentinfo[0]);
    currentpasswordfield.setText(currentinfo[1]);
    }
    }
    

Was this information helpful? Send us your comments.