Context.getCacheDir(): 这个缓存路径打印出来的是:data / data / (APPID ) / cache Android系统中的清除APP缓存清除的就是这个路径: 随着用户手动清空缓存或者APP的卸载,这个路径的缓存也会被删除。 请注意:在这个缓存路径上读写是不需要请求文件读写权限的,所以在这个路径上可以做一些不需要请求读写权限的缓存操作(图片等)。 Activity.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath(): 这个缓存对应的位置是:sdcard/Android/data/ (APPID ) /files/Download 注:因为是对SD卡进行读写来实现缓存,所以需要请求读写权限才能操作 在Android系统中清除缓存并不会删除这个路径的缓存 但会随着APP卸载而删除此路径的缓存 /sdcard/xxx/xxx/xxx.jpg : 注:因为是对SD卡进行读写来实现缓存,所以需要请求读写权限才能操作...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with HttpUrlconnection
Contact HttpUrlconnection, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack