How to save an array of objects
So, I'm making a trivia game and so I created a custom array of questions. I have an xml file in the raw folder that holds all the questions, and parses everything into my array. I want to have the ability to shuffle all the questions after the user is done with a game and s开发者_StackOverflowtarts a new one.
This is really easy to implement - just shuffle the array! The problem I run into is saving things. With Shared Preferences, I can save the index (question the user was at) when they close the app. But when I shuffle the array, and they leave the app and go back in - the array is back to the default array so the shuffle is kind of moot. You obviously can't save arrays with shared prefs - so does anyone know a simple/easy way to save the shuffled array?
Serialize and http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
精彩评论