android WebView离线缓存

2019-01-02  本文已影响0人  笑笑_520

if (NetworkUtil.isConnected(mContext))

    mWebView.getSettings().setCacheMode(LOAD_DEFAULT);

else

    mWebView.getSettings().setCacheMode(LOAD_CACHE_ELSE_NETWORK);

webSettings.setDatabaseEnabled(true);

webSettings.setDomStorageEnabled(true);

String cacheDirPath = g

etFilesDir().getAbsolutePath() +"/webCache";

mWebView.getSettings().setDatabasePath(cacheDirPath);

上一篇 下一篇

猜你喜欢

热点阅读