I was trying to serialize a TreeMap
in my Android app so I can save it to a SharedPreferences
, as suggested in this StackOverflow Q&A. It's for an ArrayList
, but I took my chances anyway. The point is to use the ObjectSerializer
class in the Apache Pig project to serialize the TreeMap into a String and save it in that data type in the shared prefs.
As soon as I imported the .jar without Hadoop, however, I began getting a lot of errors. When I run my app in the emulator (I use Eclipse), the status bar at the bottom of my IDE never goes past the message "Launching [app name] 100%..." Then, after a long while, this appears:
If I wait a little longer, more dialog boxes pop up on top of each other:
My questions are:
- What's going on and why is this happening? Might this be a bug with Apache Pig?
- Is there an alternative library which I can use to serialize my
TreeMap
? Right now, my workaround is to serialize it myself, as described in this tutorial, and save it in a file in the devices' internal memory separate from the shared prefs.