Wednesday, 11 September 2013

how to use goBack() and goForward() onClick in webView?

how to use goBack() and goForward() onClick in webView?

I plugged in a WebView four button. the first to go back, go forward to
the second, the third for the refresh, and the fourth to exit the
application but when I go to insert the functions webView.goBack ();
webView.goForward () in the onClick of the buttons if you start the
application and I click on the buttons to go back and to go on the app
crashes ... why?
imageButton3.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0){
if(webView.canGoForward()){
webView.goForward();
}
}); imageButton4.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0){
if(webView.canGoBack()){
webView.goBack();
}
}
});

No comments:

Post a Comment