开发者

Blackberry persistent store - no data saved after handheld restart

I'm trying to write an app for blackberries and I'm using the persistent store, but when I restart the device, the data is lost. Anyone's got any clue why this is happening?

thanks in advance to everyone!

    public static void add(Subscription s) throws IOException {
        Vector subscriptions = SubscriptionsController.getSubscriptions();
        if(subscriptions == null) subscriptions = new Vector();
        subscriptions.addElement(s);
        synchronized(SubscriptionsController.persistedSubscriptions) {
            SubscriptionsController.persistedSubscriptions.setContents(subscriptions);
            SubscriptionsController.persistedSubscriptions.commit();
        }
   开发者_如何学Go }


I am assuming (always a bad idea lol) that you have subclassed PersistentStore /PersistentObject (since you can commit(), etc)? Did you implement Persistable (it is not inherited by subclasses)?


SubscriptionsController isn't a Blackberry class as far as I am aware. It looks like your unexpected behaviour is due to the implementation of this class.

If you wish to persist object state across device resets, you need to use the PersistentStore API which serialises objects to a file on the Blackberry. This document on RIM's site explains use of the PersistentStore

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜