Answer the question
In order to leave comments, you need to log in
Webview why back button not working?
tell me what is the problem, the back button in the application does not work
public class Tab1 extends Fragment {
public WebView mWebView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.tab1, container, false);
mWebView = (WebView) v.findViewById(R.id.webViewT1);
mWebView.loadUrl("file:///android_asset/Maps/web/map.html");
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.getSettings().setDisplayZoomControls(false);
// Enable Javascript
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
// Force links and redirects to open in the WebView instead of in a browser
mWebView.setWebViewClient(new WebViewClient());
return v;
}
public void onBackPressed(){
if (mWebView.canGoBack()) {
mWebView.goBack();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question