public void printBackForwardList() { WebBackForwardList currentList = this.copyBackForwardList(); int currentSize = currentList.getSize(); for (int i = 0; i < currentSize; ++i) { WebHistoryItem item = currentList.getItemAtIndex(i); String url = item.getUrl(); LOG.d(TAG, "The URL at index: " + Integer.toString(i) + " is " + url); } }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { WebBackForwardList hisList = web_view.copyBackForwardList(); if (keyCode == KeyEvent.KEYCODE_BACK) { if (hisList.getSize() == 1) { finish(); } else if (web_view.canGoBack()) { web_view.goBack(); } else { finish(); } return true; } return super.onKeyDown(keyCode, event); }