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().

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 阅读《Android(安卓)从入门到精通》(13)—
  2. Android(安卓)动画监听器
  3. DecimalFormat 实现保留小数点位数及四舍
  4. Android(安卓)笔记.代码段
  5. Android(安卓)开发技巧集合
  6. Android中自定义通用Json解释器
  7. android camera系统3A模式及其状态转换(二
  8. Android(安卓)Gson 解析泛型报错
  9. Android例子—常用系统Intent合集
  10. Android打Jar包注意事项