简体   繁体   中英

What is the best way to store local in android?

I have to build a quiz app with 1500 questions .I only need one random question . so i don't really have to load all the questions once .. What is the best way to store those questions sql,json,xml ?

Probably with that amount of questions, I'd go by using a SQL database. It depends, however, what kind of choose, if local or a centralized one.

If you plan to change the questions from time to time, you can have a relatively strong server where the users might connect to a webservice and get the questions, I'd recommend a centralized storage database.

If you plan to not change them, they'll be static, or the same for all users, or you can't simply afford having a remote server, use a SQLite database which is local to every device, and each time you start your app, simply load the questions (or do queries when you need to get them).

In my oppinion, the best way in your case is to save all data on server, and when it nessery - create Post request to server and get data from it. If you want to store your data on phone, and use this data offline - SQLite is the best solution, about it you can read in this great tutorial

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM