Answer the question
In order to leave comments, you need to log in
Why does the system back button of an android smartphone kick out of the app?
I have a simple webview application. When you walk through its pages, then you click on the system "Back", the application crashes, instead of the expected return to the previous page. Why is this happening and how can it be corrected?
Answer the question
In order to leave comments, you need to log in
Hello,
to redefine the behavior of the back button for your purposes, use the following method:
@Override
public void onBackPressed() {
if(webView.canGoBack() == true){
webView.goBack();
}else{
super.onBackPressed();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question