码迷,mamicode.com
首页 > 移动开发 > 详细

Android WebView untold stories

时间:2014-10-08 23:01:37      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:android   style   color   io   ar   for   sp   c   on   

Without any doubts, Android SDK has a poor documentations. There are pitfalls and traps about APIs without any mentions in SDK documentations.

1. WebView.clearHistory()

When there is only one item in WebView’s internal back/forward list, clearHistory() won’t clear anything. When there are more than one items in back/forward list, clearHistory() will clear all the items except the top one, or the current one.

The next question you might ask is when WebView adds an item to its back/forward list when loading a URL. By listening WebChromeClient.onProgressChanged(), we can know this, when new progress is bigger than 10, the loading URL will be added to its back/forward list. So when new progress is bigger than 10, loading URL becomes current item and thus you can clear previous loaded URLs by calling clearHistory().


Android WebView untold stories

标签:android   style   color   io   ar   for   sp   c   on   

原文地址:http://my.oschina.net/u/1777508/blog/325066

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!