Using Persistent Store in BlackBerry

∥☆過路亽.° 提交于 2019-12-02 12:19:56

This link should answer most of what you need to know - http://www.miamicoder.com/post/2010/04/13/How-to-Save-BlackBerry-Application-Settings-in-the-Persistent-Store.aspx.

Below is some code from one of my projects.

public class PreferencesStore 
{
    // Not a real key, replace it with your own.    
    private static long m_lTabulaRectaKey = 0l;

    public static Vector getTabulaRectas()
    {
        Vector vecTabulaRectas = new Vector();

        PersistentObject poObject = PersistentStore.getPersistentObject(m_lTabulaRectaKey);

        if(poObject.getContents() != null)
        {
            vecTabulaRectas = (Vector)poObject.getContents();
        }

        return vecTabulaRectas;

    }

    public static void addTabulaRecta(TabulaRecta a_oTabulaRecta)
    {
        Vector vecTabulaRectas = getTabulaRectas();

        vecTabulaRectas.addElement(a_oTabulaRecta);

        PersistentObject poObject = PersistentStore.getPersistentObject(m_lTabulaRectaKey);

        poObject.setContents(vecTabulaRectas);

        poObject.commit();
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!