How is the size of cache and data calculated in the application properties?
I save all my data to the SD card, but Android shows me that I'm constantly using 4 KB, but on the SD card are about 50 KB. The same with the cache! I put a 3 MB picture in there. But my cache size is zero!
I think I'm using the correct directory: /mnt/sdcard/Android/开发者_运维问答data/my.package.name/files
and /mnt/sdcard/Android/data/my.package.name/cache
.
Has this changed in Android 4.0.x?
See this screenshot:
I believe the Cache size is the size of the Internal Cache directory that is returned by http://developer.android.com/reference/android/content/Context.html#getCacheDir()
I think you've used: http://developer.android.com/reference/android/content/Context.html#getExternalCacheDir()
The application properties page only shows usage for the internal memory, not for the external memory (SD card).
I don't know exactly why they chose to do it like this, but one reason would be that the SD card is not managed to the same degree: while you can get Android to manage SD card data for your application, you can also bypass it and use a custom folder structure.
Additionally, external memory is usually far larger than the internal memory, and can be managed by the user, so SD card usage is probably not all that important anyway.
精彩评论