In our daily development process, our app often needs to cache some data, such as the user information that has been logged in, such as whether the first landing, such as the guide of a page has no display ... Wait for this. So these are generally just a few ways:
1. Use Sharedpreference to cache, cache location in/data/data/xxx.xxx.xxx/shared_prefs. Xxx.xxx.xxx is the name of your package.
2. Using SQLite for caching, the cached data is in/data/data/xxx.xxx.xxx/databases/xxx.db.
3. File cache to SD card and so on.
How to cache is not covered in this article, so it is not discussed in depth.
After the data has been cached, how do we get to them? There are several methods:
1. Use the code to read the data and then show that the general program development is this step.
2. Ask your backstage, access the following your database to obtain the necessary information.
3. Depending on the behavior of the program, such as when you enter a page that needs to be booted for the first time without a bootstrap action, then ... If you are using a caching method to judge the words.
4. From the Android system inside the query.
What we're going to say is the last method:
Description: I use the ubuntu12.04, so if you are using the Windows need to change the place please change, in fact, there is nothing different.
1. Use ADB to connect to your mobile phone, as for how to connect please search for yourself, if your phone can not be read, please go here: Ubuntu under the ADB can not find the real machine problem solved
2. If you want to read the data below the/data/data, you need to get root permission, if your phone is root, then there is nothing to say, if not, you can use the SU command to request root permission, this time, your phone will appear the root permission to request a bullet box, Click on Allow to do it.
3. Go to the cache file directory and you can see that many of the data we cache is stored in each file directory separately.
2. Enter the sharedpreference cache of data, generally cached as XML, in which we can see some of the data we cache, using the XML key-value pairs of the way to store, which also explains that When we put the data that reads the sharedpreference cache in the main thread, the Android log system gives us the reason for the time-consuming operation warning, which is that we are reading the disk data. The name of the XML is the name we specify when we store it.
3. Next, let's take a look at the cache Data folder of Sina Weibo.
5. They cache data really a lot, we can open a look at random. We can see whether the login cache tag, the current login account, the current installed version and so on, some we can literally understand, some ..., you don't ask me, I do not know.
Next, whether you're making changes or deleting them, it doesn't matter, as long as you know what you're doing.
Android Gets the data cached by the application