SharedPreferences return only default value

后端 未结 3 1412
一整个雨季
一整个雨季 2021-01-19 13:15

So instead of creating a database, I\'m storing the data using SharedPreference.

My code is below:

   SharedPreferences.Editor editor =          


        
3条回答
  •  青春惊慌失措
    2021-01-19 14:01

    editor.putInt("favid"+id, 1);
    

    what's about id is equals to 0? here you are reading starting from 1

     for (int i = 1; i < 19; i++) {
    

提交回复
热议问题