1

ブラックベリー用のアプリを作成しようとしており、永続ストアを使用していますが、デバイスを再起動するとデータが失われます。なぜこれが起こっているのか誰かが手がかりを持っていますか?
みなさん、よろしくお願いします!

    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();
        }
    }

4

2 に答える 2

2

私はあなたがPersistentStore/PersistentObjectをサブクラス化したと仮定しています(commit()などができるので)?Persistableを実装しましたか(サブクラスに継承されません)?

于 2011-04-18T13:46:36.643 に答える
1

私の知る限り、SubscriptionsControllerはBlackberryクラスではありません。予期しない動作は、このクラスの実装が原因のようです。

デバイスのリセット間でオブジェクトの状態を保持する場合は、オブジェクトをBlackberry上のファイルにシリアル化するPersistentStoreAPIを使用する必要があります。RIMのサイトにあるこのドキュメントでは、PersistentStore

于 2011-04-18T08:32:20.440 に答える