在 BlackBerry 中使用持久存储

发布于 2024-10-10 17:56:36 字数 121 浏览 8 评论 0原文

我正在开发一个黑莓应用程序。我想在我的手机中存储多个用户的详细信息。我必须存储每个用户的用户名、名字、姓氏、电子邮件地址、电话号码等数据。任何人都可以为我提供持久存储的示例代码,使用它我可以将所有这些数据存储在向量中并稍后检索。

I am developing a BlackBerry application. I want to store the details of multiple users in my mobile. I have to store data like username, first name, last name ,email id ,phone number for each user. Can any one please provide me a sample code for persistent store using which I can store all this data in a vector and retrieve later.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月无声 2024-10-17 17:56:36

此链接应该回答您需要了解的大部分内容 - http://www.miamicoder.com/post/2010/04/13/How-to-Save-BlackBerry-Application-Settings-in-the-Persistent-Store .aspx

下面是我的一个项目中的一些代码。

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();
    }
}

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();
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文