• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help understanding error

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>.
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic