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. linux文件系统内容
  2. NFS实现开发板和虚拟机之间的文件共享
  3. Tomcat设置首页(Linux系统)
  4. 制作Linux映像和Kernel的启动
  5. 【转】【centos】Bringing up interface
  6. Linux SendMail 使用外部SMTP服务发送邮
  7. Linux第三章 命令基本格式及文件处理命令
  8. 弱智入门Linux——拉高CPU使用率
  9. gdb捕获syscall条件和字符串比较
  10. Linux命令-网络命令:netstat