Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create a custom hashtable class like this</p> <pre class="lang-java prettyprint-override"><code>package com.myapp.items; import net.rim.device.api.util.Persistable; import java.util.*; public class MyAppHashtable extends Hashtable implements Persistable{ } </code></pre> <p>And change your code to </p> <pre class="lang-java prettyprint-override"><code>public class Preferences { private static PersistentObject persistentObject = PersistentStore.getPersistentObject(0x2759d6ff72264bdbL); private static MyAppHashtable tbl = new MyAppHashtable (); public static void storeLoginToken(String token) { token = removeCharAt(token,0); token = removeCharAt(token,token.length()-1); tbl.put("token", token); persistentObject.setContents(tbl); persistentObject.commit(); } public static String getLoginToken() { MyAppHashtable tbl = (MyAppHashtable )persistentObject.getContents(); try { String token = tbl.get("token").toString(); System.out.println("Token = "+token); return token; } catch(Exception e) { return null; } } } </code></pre> <p>This is so that we adhere to the following info from RIM</p> <p><strong>The BlackBerry persistence model</strong></p> <p>When you use the BlackBerry persistence model, data is only deleted if the store contains data that belongs to the removed application.</p> <p>For example, if an application stores an object with a package called <code>com.mycompany.application.storage</code> and no other application on the BlackBerry smartphone makes reference to the package, the persistent store and the removed application are deleted.</p> <p>The same is true if the object is wrapped in a container such as a <code>Vector</code>. Even if only one of the elements of the <code>Vector</code> has a package name that is not used by other applications, the entire <code>Vector</code> is removed from the persistent store.</p> <p>Note: If the application does not store any objects with an identifying package structure, (for example, an application that stores <code>java.util.Vector</code> or <code>javax.microedition.location.AddressInfo</code> objects), the application should create and use a class that extends <code>Vector</code> in order to identify that <code>Vector</code> belongs to the given application. When you store this <code>Vector</code>, which is identified uniquely by its package, you guarantee that the data is removed from the persistent store when the application is removed.</p> <p>This <a href="http://supportforums.blackberry.com/t5/Testing-and-Deployment/Handle-stored-data-when-removing-an-application/ta-p/444832" rel="nofollow">info is from here</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload