Android将数据存储到缓存中的时间是多少?或者,存储的最大数据大小是多少?

时间:2012-10-05 13:40:44

标签: android image caching

现在,我正在使用以下方法加载图片:

public static Drawable loadCachedImage(String strUrl) {
    try {
        URL url = new URL(strUrl);
        URLConnection connection = url.openConnection();
        connection.setUseCaches(true);
        Object response = connection.getContent();
        if (response instanceof Bitmap) {
            Bitmap bitmap = (Bitmap)response;
            return new BitmapDrawable(bitmap);
        } else {
            InputStream is = (InputStream) connection.getContent();
            return Drawable.createFromStream(is, "src name");
        }
    } catch (Exception e) {}
    return null;
}

AFAIK,它使用Android的默认缓存。所以,我想知道它存储给定应用程序信息的时间(或者存储的最大数据大小是多少)。这是设置配置吗?

提前致谢!

1 个答案:

答案 0 :(得分:0)

缓存的范围取决于您的默认缓存存储,因为我们知道市场上有许多其他应用程序可用于清除缓存以用于其他用途。或者,如果用户可以从Settings->Application->Manage application->your app手动清除缓存 在此显示应用程序的总大小。