I recently had an issue with some global variables deleted by the system. From the answers I’ve understood that data in memory can be deleted anytime by the system, and that it’s better to use a database to store the data.
However, I’m often working on applications with frequently changing data, which load their data from huge databases via web-services. E.g. a catalog of items with many categories, in which the user browses only a very small part. In that case a database doesn’t seem to make sense to me, since
- the web-services generally provide the data by chunk (by category, page…) and iterating over all the categories and pages to fill the application DB does not make sense, and
- data change frequently, so it must be loaded again everytime the application is started, so we don’t need really persistent data.
In that case, isn’t it better to use a cache, to check if the data still exists, and if it’s not then reload the data? From the answers to my question it seems that it’s bad design, and I’m not sure I understand why…
Use your internal data storage, create/write/read/use your own files in your
/data/directory.It is located in:
/data/data/com.your_domain.YourAppName/from_here_is_your_internal_storage