Saving "LinkedHashMap<String, Point[]>" for later use?

Viewed 48

I am trying to save the value of "LinkedHashMap<String, Point[]>" for later use, so far I have tried using "SharedPreferences" and "ObjectOutputStream , writeObject", but both did not work and the problem is "I guess" in the value in the LinkedHashMap where it is Array of points.

Any suggestions?

Edit 1:

  • I think I can loop each Key on the LinkedHashMap and get the Points array, then loop all points and convert it to string, then use split to convert it back, but I am not sure if its good solution or not.

Edit 2: "did not work" means

  • for "SharedPreferences" , I could not find method like getArray or getobjects , only what work is getstring so I get back to "Edit 1"

  • for "ObjectOutputStream" , the output file was unreadable not sure if it is should , but when i use in.readObject() then Cast it to (LinkedHashMap<String, Point[]>) i got this error (java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: android.graphics.Point)

0 Answers
Related