Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: How to store an arrayList in SharedPreferences?

Gibs:

I have a sorted Arraylist of contacts. I want to Store the list in shared preference. I have tried the below code :

store


SharedPreferences.Editor editor = app_preference.edit();
Set set = new HashSet();
set.addAll(contact_names_list);
editor.putStringSet("CONTACT_LIST", set);
editor.apply();

The problem is, when I retrieve this from Hashset I got an unsorted list. Is there any other way to store arraylist other than Hashset?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: How to store an arrayList in SharedPreferences?

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×