I'm designing an app which involves parsing a large XML(which include lots of text) and keeping the serialised data accessible throughout the application. I intend to have a data object which will keep the data stored and some classes can access the data. I alway need to show only part of the text.
yes my problem is very similar to this question maybe it's the same problem, but I don't want to use this solution, if is it possible.
I would like to know how to load the data, where to load it and how to keep it accessible throughout the application. It's impossible to load it everytime in onCreate()
method, for example when the screen orientation is changed.
Best way for me, would be if I could load (parse) the xml file into one object and this object keeps accessible throughout the application, but I don't know where, how to load it and how to keep it accessible throughout the application. This object has everything what I need.
some possible solutions:
- Singleton (this would load data into one object) use this or something else ?
- Using a SQLite solution like there (same link as above) (I don't want use this)
- Use lazy loading (load the part of text, which I actualy need) (I don't want use this as well)
Could someone say what would be best solution ? And describe how to do it ?
(Sorry for my english)
EDIT 1: xml structure:
< root > < some elements > < /some elements > < element with lot of text > text..... < /element with lot of text > < element with lot of text > text..... < /element with lot of text > . . . < element with lot of text > text..... < /element with lot of text > < /root >
if it will be helpful. Text in one element usually includes 5000 - 15000 characters.