Search code examples
androidobjectsharedpreferences

store and retrieve a class object in shared preference


In Android can we store an object of a class in shared preference and retrieve the object later?

If it is possible how to do it? If it is not possible what are the other possibilities of doing it?

I know that serialization is one option, but I am looking for possibilities using shared preference.


Solution

  • Not possible.

    You can only store, simple values in SharedPrefences SharePreferences.Editor

    What particularly about the class do you need to save?