NetworkUtils.java 文件源码

java
阅读 40 收藏 0 点赞 0 评论 0

项目:pandroid 作者:
/**
 * Enable caching for http request : must use HttpUrlConnection !
 * see : <a href="http://developer.android.com/reference/android/net/http/HttpResponseCache.html">HttpResponseCache</a>
 *
 * @param context
 */
public static void enableHttpCaching(Context context) {
    long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
    try {
        File httpCacheDir = new File(context.getCacheDir(), "http");
        HttpResponseCache.install(httpCacheDir, httpCacheSize);
    } catch (IOException e) {
        Log.i("", "HTTP response cache failed:" + e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号