• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help understanding error

 
L Vasquez
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to successfully store and retrieve an arraylist of URIs. I'm not entirely sure where to put the 'storing' part, but it made sense to put it in onPause. My app crashes when I try to leave the activity though. I got a similar error when I tried to put it in onStop originally. Please help know what I'm doing wrong here.



My onPause method is below. Person1Screen.java:257 is the editor.commit line at the end.



My retrieval in my onCreate (in case it helps):



"happyList" is of type ArrayList<Uri>.
 
Norm Radder
Bartender
Posts: 1526
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the type of the objects you are trying to write?
Do they implement Parcelable?
 
L Vasquez
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm Radder wrote:What is the type of the objects you are trying to write?
Do they implement Parcelable?


Arraylists implement Parcelable as far as I know. But what I did here was convert my ArrayList<Uri> to Set<String> and from there stored it in my sharedPreferences. From what I've read and examples I've followed, storing Strings shouldn't cause any problems.

I can't find anything online about the the initial error in the logcat: "java.lang.RuntimeException: writeValueXml: unable to write value ... "
 
Norm Radder
Bartender
Posts: 1526
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do some debugging to see what data types are in tempSet .  For example use toArray and print out the class using getClass() of the first object in the array.

The code is not using generics for the HashSet so the compiler does not give an error, only a warning.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic