0

I am creating shared preferences objects as follows:

sh_subjecturi = context.getSharedPreferences("MyCourse__Set", Context.MODE_APPEND);

Editor editor_subjuri_set;

editor_subjuri_set = sh_subjecturi.edit();

Next in the loop, I am putting the data using the editor object.

When I am executing my program , I am getting the MyCourse_Set.xml file but the data is not in order (jumbling format i.e chapters are not coming in order as available).

How do I solve this issue?

StuperUser
  • 10,555
  • 13
  • 78
  • 137
user3297196
  • 47
  • 2
  • 11

1 Answers1

0

If I'm getting your point right, the SharedPreferences is basically a Map<Key, Value> Class (Check SharedPreferences - Android Developers), which is designed without order inside as you can always find value via key.

Therefore if you need an ordered data, you can save them into a List then put them into SharedPreferences

dumbfingers
  • 7,001
  • 5
  • 54
  • 80