Android webview and loadData, can I return the return button to the generated content?

I have an android webview that displays generated content with loadDataWithBaseURL. It looks great. However, if I follow the link and then click the "Back" button, I get a blank page where I would like to see my generated content.

Does anyone know how I can use the back button to return to my generated content?

+7
source share
1 answer

Try the following:

 mWebView.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { switch(keyCode) { case KeyEvent.KEYCODE_BACK: if(mWebView.canGoBack() == true){ mWebView.goBack(); return true; } else return false; } return false; } }); 
0
source

All Articles