Stefan,

Thanks for leading me down the right path.  I still encountered situations 
where the history wouldn't be cleared if I did it in 'onPageFinished', so I 
ended up doing it in 'onProgressChanged' in the WebChromeClient: 

webView.setWebChromeClient(new WebChromeClient() {
  public void onProgressChanged(WebView view, int progress) {
    if (progress == 100 && mClearWebViewOnPageLoaded) {
      view.clearHistory();
      mClearWebViewOnPageLoaded = false;
    }
  }
});

Jeremy

On Thursday, April 2, 2009 6:28:46 AM UTC-5, StefanK wrote:
>
> I recently had the same issue. What I found is that you have to clear 
> history AFTER the (first) page loads. It appears that the history 
> clears everything before the current page so if your browser is at 
> page "A", you clear history and navigate to page "B" your history will 
> be "A" "B", not just "B", but if you clear history when "B" finishes 
> loading you will have only "B". 
> In my case I end up using "onPageFinished"  method of the 
> WebViwClient, but in this case you have to know what your start page 
> is and clear the history only after it otherwise you will be clearing 
> the history after every page navigated after the first. 
>
> Stefan 
>
> On Mar 31, 6:05 pm, "nEx.Software" <justin.shapc...@gmail.com> wrote: 
> > I call WebView.clearHistory(), but I am still able to go back after 
> > doing so. I want to reuse a WebView, but I don't want the back button 
> > to allow the user to go back further than the current "session" of 
> > using the WebView. Anybody know what is the best way to handle this? I 
> > thought for sure that clearHistory() would do it.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to