Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3988354
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:14:31+00:00 2026-05-20T06:14:31+00:00

I’m creating a news reader app that, at times, loads web pages into a

  • 0

I’m creating a news reader app that, at times, loads web pages into a WebView.

I noticed that with default behavior, the cache can get very unreasonable very quickly. Whether or not Android will clear out that cache when memory gets low, I’m not okay with my users seeing a 15MB news app when everything except the web cache is about 1MB.

However, I would love to use the cache to some extent. I saw WebSettings#setAppCacheMaxSize() and it seemed like it was just the ticket.

It doesn’t seem like it does anything. I hardcoded the following into a method that is called by my activity’s onCreate(), before anything is loaded:

originalSourceWebView.getSettings().setAppCacheMaxSize(300*1024); (I was using a larger, configurable value but dropped it lower to confirm my problem).

I blow right by 300KB without any fanfare, as shown by settings->applications->manage applications->click on my app. I’m listening in WebChromeClient#onReachedAppMaxCacheSize for events, but that never seems to trigger.

Has anyone successfully used this? Is there some different cache I should be trying to manage? The docs seem pretty sparse. I went into the android source but it just sends values off to native code, and I don’t know how to delve into that.

My test environment is a nexus one on 2.2.2. I know that I’ll need to make the cache calls by reflection in order to support 1.5 and 1.6, but if I can’t make this work, there will be no need.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:14:31+00:00Added an answer on May 20, 2026 at 6:14 am

    I don’t think there’s an API to do what you want.

    setAppCacheMaxSize limits the cache size for the HTML5 application cache API — the offline storage that HTML 5 apps can use while running in your WebView — but it sounds like you want to limit the cache used for loading pages. images, etc.

    As a workaround you could call WebView.clearCache periodically, although that really limits the effectiveness of the cache. If you want to try and keep some recent pages around, you could look into getting them from CacheManager before clearing the cache and then restoring them afterwards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.