Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set cache ? #222

Open
goadsth opened this issue Mar 12, 2020 · 2 comments
Open

How to set cache ? #222

goadsth opened this issue Mar 12, 2020 · 2 comments

Comments

@goadsth
Copy link

goadsth commented Mar 12, 2020

I used editor.getSettings() to set web's cache,but it didn't work,it load pictures slowly everytime I reopened the same activity.

@yeaper
Copy link

yeaper commented Apr 2, 2020

like this:
private void addCookies(String url) {
CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cookieManager.removeSessionCookies(null);
PersistentCookieStore cookieStore = new PersistentCookieStore(UIUtils.getContext());
for (Cookie cookie : cookieStore.getCookies()) { //add cookie
cookieManager.setCookie(url, String.format("%s=%s", cookie.name(), cookie.value()));
}
cookieManager.flush();
}
}

@goadsth
Copy link
Author

goadsth commented Apr 2, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants