06-17-2010 11:19 PM
Hi all,
Apologize for such a newbie question. I am reading the "PersistentStorage" tutorial and everyhing is clear to me except one thing.
private static long key = 0xdec6a67096f833cL;
static {
_objStore = PersistentStore.getPersistentObject(key);
synchronized(_objStore){
if (_objStore.getContents() == null ){
_objStore.setContents(new Vector());
_objStore.commit();
}
}
_data = (Vector) _objStore.getContents();
}
Where do you get/obtain key? Is is something that you must generate beforehand? If it is, how to generate? There is absolutely no info on this key on the tutorial.. it's just there...
Solved! Go to Solution.
06-17-2010 11:33 PM
Pick a string that's likely to be unique (say, the fully qualified name of your application's main class). Type it into a comment (to keep Eclipse from complaining):
// com.example.blackberry.MyApp
Then highlight the string, right click, and select "Convert String to Long" from the menu. Now you'll have a key. You might want to write a second line of comments to document where it came from. ![]()
I forgot where I learned this, but it was from the RIM documents somewhere. I agree that it isn't documented where you're likely to be reading when you need it (like the API docs for PersistentStore).
06-17-2010 11:52 PM - edited 06-17-2010 11:56 PM
Wheew! Thank you. Exactly what I need.
I am sure a lot of other people were looking for this as well..