Android Webview - Prevent Reload When Go Back to the App

android-webview

Solution

Test this by adding `android:launchMode="singleInstance"` to your `<activity>` element in your `androidmanifest.xml`.

Problem

How to prevent reload on webview when your back to the app? When tapping home key and then back to the app, the webview was reloaded. I dont want this behaviour, I want users to view the previous page (w/o reload) that they accessed. ``` private WebView webView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webView = (WebView) findViewById(R.id.webView); webView.setWebViewClient(new WebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl( WEBSITE_URL ); } ``` thanks

Original source