0
私はBlackBerryアプリケーションを開発中です。自分の携帯に複数のユーザーの詳細を保存したい私はユーザー名、名、姓、電子メールID、各ユーザーの電話番号のようなデータを格納する必要があります。このデータをすべてベクトルに格納して後で取り出すことができる永続ストアのサンプルコードを提供してください。BlackBerryで永続ストアを使用する
私はBlackBerryアプリケーションを開発中です。自分の携帯に複数のユーザーの詳細を保存したい私はユーザー名、名、姓、電子メールID、各ユーザーの電話番号のようなデータを格納する必要があります。このデータをすべてベクトルに格納して後で取り出すことができる永続ストアのサンプルコードを提供してください。BlackBerryで永続ストアを使用する
このリンクは、あなたが知る必要があるもののほとんどに答える必要があります - 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();
}
}
ああ、助けてくれてありがとうございますzechariahs.Iそれに親切に感謝:) – user469999