开发者

How does Android calculate cache and data size?

开发者 https://www.devze.com 2023-04-13 06:57 出处:网络
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

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:

How does Android calculate cache and data size?


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.

0

精彩评论

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

关注公众号