10
I'm starting a new app with minSdkVersion="14" and targetSdkVersion="17". It contains a viewpager with 6 pages. There is 3 webviews and 3 others views.
When i push my app to background by clicking on back or home button, it uses about 40MB in "cached background process" and i don't understand why.
This is an example of one of my webview :
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
public class Presentation extends Fragment {
boolean isOption = false;
RelativeLayout main = null;
WebView web_main = null;
public Presentation () {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
main = (RelativeLayout) inflater.inflate(R.layout.webview, container, false);
return main;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
web_main = new WebView(getActivity().getApplicationContext());
web_main.setWebViewClient(new WebViewClient());
web_main.getSettings().setAppCacheEnabled(false);
web_main.loadUrl("file:///android_asset/main.html");
main.removeAllViews();
main.addView(web_main);
}
@Override
public void onDestroy() {
super.onDestroy();
Log.i(getClass().getName(), "[OnDestroy]");
main.removeAllViews();
web_main.destroy();
main = null;
web_main = null;
System.gc();
}
}
I followed several tutorials and answers but there are no effect on cached background process This is my ma