i am in the process of making my first Android app (also my first real java program thats not a console program). What i am trying to accomplish is this, i have a large amount of static data, organised like this:
Name: Python
Size: 2m
Danger: low
Region: QLD
Breeding: live young
Color: brown
Info: here the would be a long string a few hundreds words long
i have about 200 sets of data like that i need to store, along with a image for each one.
I also need to be able to sort the data the following ways within the java code:
A to Z
By Region (like so all the ones from QLD get shown, and then the ones from NSW, or only ones from QLD get shown, etc)
By Danger (so most dangerous get listed first)
By colors
and by size
So i need to be able to sort the data by its properties.
Can anyone please tell me which is the best way of storing this data?.
the ways i can think of are:
Database (easy to sort the data, but slower then other methods, and harder to create)
XML (i am not sure if you can sort the data the ways i need in XML)
Create a java class, and then create instances of the class for each set of data i need to store (i think this method is best for dynamic data, not for static data).
Can anyone please tell me which way i should store the Data of mine?.
I have asked my farther who is a C#.net developer, and he thought that either the database or Class methods are best, but he isnt sure about java and android.
Thanks
Corey B
Store the text data in a database and the pictures on the file system either internal or sd card.
You should use database if you want your data stored in your phone. This tutorial might help you with using database in android : http://www.vogella.com/articles/AndroidSQLite/article.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.