How to add data dynamic on recyclerView and save the data?

后端 未结 2 1160
执念已碎
执念已碎 2020-12-22 06:21

I want to save the data when user input edit text.

It can show on recyclerView and the app can show it again when the app had restarted.

I try to user share

2条回答
  •  礼貌的吻别
    2020-12-22 06:39

    If you have a large amount of data, you need to have SQL. If you want to use shared preference, you may try this:

    private void saveBlood(){
        SharedPreferences preferences = getSharedPreferences("uerInputBlood", MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        listData.clear();
        editor.putInt("count", listData.size());
        for(int i=0; i

    Hope it help :)

提交回复
热议问题