SharedPreferences or SQLite Database?

烈酒焚心 提交于 2019-12-24 03:18:52

问题


I'm writing a small alarm clock application, and I'm currently using SharedPreferences to store the settings for each alarm. I figured this would be more lightweight than using the SQLite Database, but now I'm thinking about writing a small thread-safe wrapper for SharedPreference. Am I being an idiot and should just use the database or would this still be more light-weight than the database?


回答1:


For something this small, how lightweight it is isn't really relevant. Its a matter of 10 nanoseconds versus 50 nanoseconds (not literally but you get the idea). Just use what is easier and more reliable for your app



来源:https://stackoverflow.com/questions/9012521/sharedpreferences-or-sqlite-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!