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 8894867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:37:06+00:00 2026-06-14T23:37:06+00:00

My app’s main activity is a Activity that contains a Webview to load web

  • 0

My app’s main activity is a Activity that contains a Webview to load web pages.

I override the method shouldOverrideUrlLoading(WebView view, String url) to make every URL request call up an Intent and load in a new same activity containing WebView.

Doing this is to provide a better experience when BACK key is pressed, will just finish the current activity and back to the former activity, need no time to render the page again comparing to use goBack() in single webview.

But now the problem is that, after I open many URLs, creating a long queue of activitys in the background, the memory it uses became large.

When I go back to launcher and check the progresses, I can see my app caches more than 200M data. This is not acceptable…

And it’s interesting that I can see my app used up my memory, but in the Heap view of DDMS in Eclipse I can see the app allocated no more than 10M memory. So I guess the 200M is webStorage cached by Webview?

Is there any way to control the memory?

I’m considering just save maybe 5 layers of activities at a time and when go back 5 times just jump back to home page. But still don’t know how to release memory beside the 5 activities I need, which I’ll never use again?

Or if it’s because the WebView is keeping web page cached automatically, how can I manager this manually? Such as setting a limit of maximum cache size or page count?

  • 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-06-14T23:37:07+00:00Added an answer on June 14, 2026 at 11:37 pm

    Generally speaking I agree with Kevin’s comment. I think keeping multiple Activity objects around to prevent reloading a WebView is counter-intuitive to a mobile environment with such limited resources.

    That being said, you have a lot of different question and solution possibilities, so I don’t have a single answer in mind. Look through these links to see if anything is helpful:

    ActivityManager – has a ton of stuff you might be able to use, check out it’s sub-classes.

    ActivityManager.RunningTaskInfo – Never used it, but seems to have some useful stuff, especially with determining which Activity‘s are running.

    ActivityManager.MemoryInfo – Can give you info on the available system memory as well as a bottom threshold of memory.

    Application.onLowMemory() -Tells you when your app has been a memory hog. You could override this method and start destroying Activity‘s when this gets called. You probably need to call super.onLowMemory() to make sure the OS handles what it needs to.

    One possible solution involving controlling the number of activities:

    Override Application and create a public static ArrayList<Activity> that holds 5 Activity objects. Whenever you perform an onCreate() for an Activity you could add the Activity to the ArrayList and then check the size. If size is > 5 then send an intent to the Activity at position 0 that will cause it to handle the intent and call finish(). Then remove the object from the ArrayList.

    Shouldn’t be too much work, but the down-side is that you have to manually manage things. I am sure there is a more savvy solution possible.

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

Sidebar

Related Questions

App has fragment activity with framelayout container matching parent. User interacts with fragments ui
My app crashes when I try to launch a new activity. The stack trace
My app uses LoadLibrary to load plugins at run-time and users can accidentally try
App crashes after execution of cellForRowAtIndexPath method of tableView It goes into: UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:]
app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] })); That's the line in my app.js
My app uses the android.support.v4.view.ViewPager class. For each page in the ViewPager, I want
App store approval guideline says that Apps that send Push Notifications without first obtaining
app.get(/:name?/:group?, function(req, res){... is matching files that are in my public directory. So if
/app.js var Welcome = Ember.Application.create({}); Welcome.person = Ember.View.extend({ personName: 'Andrew' }); Here is the
Web app is being written in classic ASP with a MSSQL backend. On this

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.