Reputation: 606
I plan on reading several files when my app/game is created and using the information from them for the entirety of the app. I also have to write to the file at one point.
I have two files. One is a 2-column text file that I'll turn into a dictionary for fast searching. The other is a text file that has 11 columns. I'll make a dictionary out of two of the columns, and the other data I need kept as is so I can write to the columns to count the amount of times something happens in different circumstances for datamining.
Currently, I've turned the second file into a list of a list of strings, or List>. I can't figure out how to pass that around in intents. ".putStringArrayListExtra" only works for a list of strings.
Am I going about this the wrong way entirely? This is my first real Android app.
Upvotes: 1
Views: 74
Reputation: 13761
In order to store a data structure into an Intent
, it has to be either serializable or parcelable. If your data structure is neither of them, you might create a class that would implement Serializable
and manage it. A good example might be found here.
Once done, you then might use Intent.putSerializable(...)
to store your data structure. See this:
Additionally to this, if you could convert your structure into a JSON
structure, you'd already have it done since it would be treated as a String
. If not, the above solution should be easy to do.
Upvotes: 1