×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    11

    thanks for any suggestions?

    hi every one!
    I am new in J2me , would you mind to tell me how to deal with RecordStore ?
    Now I open a RecordStore in startApp() method ,remain the reference to the RecordStore until close the RecoreStore in the destroyApp(boolean) method .But i find when I shut down the phone ,It will not invoke destroyApp(boolean) method ,so the RecoreStore is not closed .
    Will it be a big damage to Recoredstore ?

    is it a better solution that opening the Recordstore as soon as I want to modify the record in it ,and close it immediately after the operation is done?

    Thanks in advance!
    Henry

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Irving, Texas, USA
    Posts
    419

    RE: thanks for any suggestions?

    Hello Henry,
    I'm always accessing RecordStore in as atomic fashion as possible, which means that I
    - open RecordStore
    - access/save record data
    - close RecordStore
    in one try-catch-finally paragraph. I have one RecordStore instance variable which I reassign every time I need to access records.
    An example:
    public class someclass
    RecordStore rs;
    try {
    rs = RecordStore.openRecordStore("myrecords", false);
    //do something with the data
    }
    catch (RecordStoreException rse) {
    //do something if there was a problem, or nothing
    }
    finally {
    // Close record store
    try { if (rs != null) rs.closeRecordStore(); }
    catch (RecordStoreException rse) { }
    }
    Regards,
    Petteri
    Forum Nokia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •