Kirti
Kirti

Reputation: 701

Null pointer while using Persistent Store in blackberry

i used these for storing data :

value="1";  
FieldChangeListener listenerslider = new FieldChangeListener() {
    public void fieldChanged(Field field, int context) {

        synchronized(store) {
            store.setContents(value); 
            store.commit();
        } 

        Dialog.inform("Success!");
    }
};

and these is for fetching that data

synchronized(store) {
    String currentinfo = (String)store.getContents(); 
    if(currentinfo == null) {
        Dialog.inform("error");
    } 
    else {
        edtplasmasodium.setText(currentinfo);   
    }
}

// these one i used in both class

  static PersistentObject store;
  static {
       store = PersistentStore.getPersistentObject( 0xa1a569278238dad2L );
  }

why ? i am getting null pointer while fetching data in second class or shall i want to use a real device for testing that functionality?

Upvotes: 1

Views: 70

Answers (1)

TheLittleNaruto
TheLittleNaruto

Reputation: 8473

Change if(currentinfo==null)

to if(currentinfo.equals(null))

Upvotes: 1

Related Questions