Array/Data Storage Options

陌路散爱 提交于 2019-12-02 07:54:48

You could add store-count as key-value pairs to SharedPreferences

http://developer.android.com/guide/topics/data/data-storage.html#pref

It's a lightweight storage and pretty handy for stuff like this.

I would write the values to file using an ObjectOutputStream:

    public static void saveArray(String filename, String[] array) {
    try {
        FileOutputStream fos = openFileOutput(filename, Context.MODE_PRIVATE);
        ObjectOutputStream out = new ObjectOutputStream(fos);
        out.writeObject(array);
        out.flush();
        out.close();
    } catch (IOException e) {}
}

Then edit the above to save word counts as an int (or short) array.

Use SQLite database to store your Store name and its count value. With its use, you can enhance your app's storage possibilities up to full extent.

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