-1

I have created an app opening a website in webView. It was working fine but few days back I'm facing a issue that when a user above android version 6.0 presses a back button webview closes. Searched it on the internet found that webview is disabled in certain android versions? Any Solutions for this? How Can I upgrade / resolve the issue?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

0

You should override your Activity's onBackPressed method, as stated in the docs

@Override
public void onBackPressed() {
    if (mWebView.canGoBack()) {
        mWebView.goBack();
        return;
    }

    // Otherwise defer to system default behavior.
    super.onBackPressed();
}
Ariel Carbonaro
  • 1,529
  • 1
  • 13
  • 25