getting WebView history from WebBackForwardList

試著忘記壹切 提交于 2019-12-05 04:34:14

On your webView instance, just use copyBackForwardList(), for example

WebBackForwardList wbfl = webView.copyBackForwardList();

Then setup a for-loop to scan the list, pull entries (e.g., title, URL), and send them to your ListView (or whatever).

Yeah, you can use WebBackForwardList

Example:

public void getBackForwardList(){
    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 );
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!