开发者

Prefer Database or File for data in Android

I already have a database and when开发者_StackOverflow社区 i write in it i also want to write only one value(store a counter)!because i think that searching for a value first and then search again for a value of counter will be slow i thought using a file to store the counter...but read write delete wouldn't be slow? So,which one is faster and safer(from point of less chances to break)?which method should i be using?


Use SharedPreferences for storing a single value it will be very efficient.


As this is only one value and only one user will be using it at a time so I think file will be better because database is easy to search and insert by a query language while file system is simple and fast but only less use because it become difficult to handle the things that we handle with db.

In your case it is a simple counter so it is better to use a single file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜