哪里是文件时使用getCacheDir [英] where is the file when use getCacheDir

查看:282
本文介绍了哪里是文件时使用getCacheDir的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我调试,我发现GetCacheDir符 /数据/数据​​/ yourapp /缓存/

不过,正如我存储文件,我发现在这条道路没有(有壳),
但在 / SD卡/ Android的/数据/ yourapp /缓存/ 我找到了缓存文件?
谁可以告诉我为什么吗?


解决方案

  

当我调试,我发现GetCacheDir回报/数据/数据​​/ yourapp /缓存/


这听起来很正确的<一个href=\"http://developer.android.com/reference/android/content/Context.html#getCacheDir%28%29\">getCacheDir.


  

不过,正如我存储文件,我没有发现任何在这条道路(含壳),但在/ SD卡/ Android的/数据/ yourapp /缓存/我找到了缓存文件?谁可以告诉我为什么吗?


这是你从<一个得到什么href=\"http://developer.android.com/reference/android/content/Context.html#getExternalCacheDir%28%29\">getExternalCacheDir.

您确定您使用正确的API调用?你检查你的文件操作的返回值(它们是所有成功的)?你可以尝试一些文件功能检查,事情正在工作的权利。 (createNewFile,存在,getAbsolutePath)

As I debugged, I found that the GetCacheDir return /data/data/yourapp/cache/

But as I store files, I found nothing in that path(with shell), but in /sdcard/Android/data/yourapp/cache/ I found the cache file? who can tell me why?

解决方案

As I debugged, I found that the GetCacheDir return /data/data/yourapp/cache/

That sounds right for getCacheDir.

But as I store files, I found nothing in that path(with shell), but in /sdcard/Android/data/yourapp/cache/ I found the cache file? who can tell me why?

That's what you'd get from getExternalCacheDir.

Are you sure you're using the right API call? Did you check the return values of your File operations (are they all successful)? You could try some File functions to check that things are working right. (createNewFile, exists, getAbsolutePath)

这篇关于哪里是文件时使用getCacheDir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆