Android WebView Save Cache to external Storage

Source: Internet
Author: User

SOURCE Blog: http://www.devahead.com/blog/2012/01/saving-the-android-webview-cache-on-the-sd-card/

The main idea is to indirectly change the results obtained by WebView acquiring the cache directory by the override Getcachedir () method at the activity level;

Getcachedir () and Getfilesdir () are often used when saving the cache (file), which returns the default result as/data/data/package name/cache (files).

However, this can be very internal Storage, and automatically clears the contents of the cache directory when internal Storage tense.

At this point, consider to save the file in external strorage, become a feasible scheme;

Two types of positions:

1./sdcard/android/data/Package name/cache (files)

Similar to/data/data/package name/cache (files), just move to external Storage, clear the cache in application management, will kill the corresponding file directory and content, uninstall the application will be automatically cleared;

2./sdcard/the Custom Directory

Unless manually removed in file management, it will persist;

Choose according to different needs;

Android WebView Save Cache to external Storage

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.