1

我用这些来存储数据:

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

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

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

这些是用于获取该数据

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

// 这些我在两个类中都使用过

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

为什么 ?我在二等舱中获取数据时得到空指针,还是我想使用真实设备来测试该功能?

4

1 回答 1

1

改变if(currentinfo==null)

if(currentinfo.equals(null))

于 2013-10-30T06:04:43.000 回答