Issue
I am developing custom browser for android. When browser supports javascript, when you surf the site application gets much more Ram than I use browser without javascript support. Please give an advise how to resolve this problem
public void onCreate(Bundle savedInstanceState) {
mWebView=new WebView(getApplicationContext());
mWebContainer=(FrameLayout)findViewById(R.id.web_container);
mWebContainer.addView(mWebView);
mWebView.getSettings().setUserAgentString("");
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.getSettings().setDatabaseEnabled(true);
mWebView.getSettings().setGeolocationEnabled(true);
mWebView.getSettings().setSupportZoom(true);
mWebView.getSettings().setSavePassword(true);
mWebView.getSettings().setSaveFormData(true);
}
........................................
private static class HelloWebViewClient extends WebViewClient
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
........................
protected void onDestroy()
{
super.onDestroy();
mWebContainer.removeAllViews();
mWebView.destroy();
mWebView=null;
System.gc();
}
created a simple WebView, such as a memory leak.
Solution
I'm not sure you have any choice. Memory usage is managed by the webview widget, and so by the system.
So your app will use a lot of memory.
Answered By - Aerilys
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.