我用这些来存储数据:
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 );
}
为什么?我在第二类中获取数据时获取空指针,或者我是否想使用真实设备来测试该功能?
答案 0 :(得分:1)
更改if(currentinfo==null)
到if(currentinfo.equals(null))