jibysthomas jibysthomas - 1 year ago 179
Android Question

Saving a hash map into Shared Preferences

How I can save a Hash Map into the Shared Preferences in Android?

Answer Source

I would not recommend writing complex objects into SharedPreference. Instead I would use ObjectOutputStream to write it to the internal memory.

File file = new File(getDir("data", MODE_PRIVATE), "map");    
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(file));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download