Mx.android.webview-android

Add .

@Override public void onBackPressed() { if (myWebView.canGoBack()) { myWebView.goBack(); } else { super.onBackPressed(); } } Use code with caution. Copied to clipboard 5. Advanced Features & Optimization Build web apps in WebView - Android Developers mx.android.webview-android

In your activity's layout file (e.g., activity_main.xml ), define the WebView widget . Use match_parent for both width and height to ensure the web content covers the full screen. } else { super.onBackPressed()

Use findViewById(R.id.myWebView) to get the reference. mx.android.webview-android