Persistence store in blackberry

Posted by arunabha on Stack Overflow See other posts from Stack Overflow or by arunabha
Published on 2011-01-31T12:41:26Z Indexed on 2011/01/31 15:25 UTC
Read the original article Hit count: 228

Filed under:
|

i am trying to save a simple string value "1".If i go back from one screen to another,its saving,but when i exit the app,and start again,i dont see that value being saved.I am implementing persistable interface.Can anyone suggest me where i am getting wrong

import net.rim.device.api.util.Persistable;
import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.system.PersistentStore;
public class Persist implements Persistable {
    public static PersistentObject abc;
    public static String b;

    static {
          abc = PersistentStore.getPersistentObject(0xb92c8fe20b256b82L);
    }

    public static void data(){
        synchronized (abc) {
            abc.setContents(1+"");
            abc.commit();
         }
    }
    public static String getCurrQuestionNumber() {
        synchronized (abc) {
            System.out.println("new title is"+b);
            b= (String)abc.getContents();
            System.out.println("title is"+b);
            return b;
        }
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about blackberry