How to delete an object store on Persisten Object on Blackberry?
I have a class with name DataContext th开发者_运维问答at use Hashtable to save data to Persistent Object. Example I save two object:
DataContext data = new DataContext();
data.set("object1", EditField1.getText();
data.set("object2", EditField2.getText();
data.commit();
I only want to delete data of "object1" ( not delete data of "object2" ), so i can not use data.clear(); I make like this code:
if(data.get("object1")!=null){
data.set("object1",null);
data.commit();
}
But I received error " App Error 104 NullPointerExceptions ". How I can to delete data of "object1" ? Please help me.
Binh - VietNam
If you want to remove an element from a Hashtable then use the remove() method of your hashtable object.
精彩评论