There are two activities. The first one is the ListView, the second WebView, which loads the html files from the project's raw resources. The web element works with this simple code:

WebView webView; webView = (WebView) findViewById(R.id.webView); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setSupportZoom(true); String text = readRawTextFile(context, getResources().getIdentifier(resName, "raw", "mypackagename")); webView.loadDataWithBaseURL("file:///android_asset/", text, "html", "utf-8", null); 

In each html resource under the title there is a picture-link due to the size, it refers to the full size of the picture itself. The code in html is simple, like a bath list:

 <a href="file:///android_asset/pic1.jpg"><img src="file:///android_asset/pic1.jpg" height="300dp"></a> 

When I exit the full-size image, I get to my list, and not back to the html file. It was clear that the "BACK" button is perceived by the layout, not by the webView. After reading the documentation from Google, I found this way:

 @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // Check if the key event was the Back button and if there's history if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) { myWebView.goBack(); return true; } // If it wasn't the Back key or there's no web page history, bubble up to the default // system behavior (probably exit the activity) return super.onKeyDown(keyCode, event); } 

It seems that the simplest code should work. But when checking it turned out that when returning from the full image, the html file is not loaded back, and I get on a blank white screen, from which I go back to the list. Perhaps this is due to the fact that I have a lot of html-files, which, depending on the conditions, loads the right one. But here I am just guessing, and I am at an impasse. What do you think about this?

    0