I use below code to go back in webview at first try. But for the low render ability, I used XWalkView replace the WebView.
public boolean onKeyDown(int keyCode, KeyEvent event) {
WebView mWebView = (WebView) findViewById(R.id.webview);
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if (mWebView.canGoBack()) {
mWebView.goBack();
} else {
finish();
if (MainActivity.mTencent.isSessionValid()) {
MainActivity.logout();
}
}
return true;
}
}
return super.onKeyDown(keyCode, event);
}
When change to XWalkView, I only find this about go back in the XWalkView. But I cannot find an example about to use it. When I not implement the back button envent, the app will exit after I double click the back button.
My question is: 1. How to use go back in the XWalkView, if some code may be more helpful. 2. How can I disable the back button click event, when I not use the go back functon.
Thank you in advance.