简体   繁体   English

Android如何计算缓存和数据大小?

[英]How does Android calculate cache and data size?

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. 我将所有数据保存到SD卡,但Android告诉我,我一直在使用4 KB,但在SD卡上大约是50 KB。 The same with the cache! 与缓存一样! I put a 3 MB picture in there. 我在那里放了一张3 MB的照片。 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 . 我想我正在使用正确的目录: /mnt/sdcard/Android/data/my.package.name/files/mnt/sdcard/Android/data/my.package.name/cache


Has this changed in Android 4.0.x? 这在Android 4.0.x中有变化吗?

See this screenshot: 看这个截图:

The application properties page only shows usage for the internal memory, not for the external memory (SD card). 应用程序属性页面仅显示内部存储器的使用情况,而不显示外部存储器(SD卡)的使用情况。

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. 我不确切地知道他们为什么选择这样做,但一个原因是SD卡的管理程度不同:虽然您可以让Android为您的应用程序管理SD卡数据,但您也可以绕过它并使用自定义文件夹结构。

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. 此外,外部存储器通常远大于内部存储器,并且可以由用户管理,因此SD卡的使用可能并不是那么重要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM