Webview with progress and url overriding

by Chister Nordvik » Fri, 09 Oct 2009 14:10:38 GMT


Sponsored Links
 Hi!

I would like to add a Webview that both intercepts the URL clicks and
shows a progress when loading.

URL overriding:
myWebView.setWebViewClient(new WebViewClient() {
                    @Override public boolean shouldOverrideUrlLoading(WebView 
view,
String url) {
...

Progress:
myWebView.setWebChromeClient(new WebChromeClient(){
          @Override
          public void onProgressChanged(WebView view, int newProgress) {
...

But is there any way to combine these two? The WebViewClient only
offers OnPageFinished and then I can't show any real progress when
loading.

-Christer

--~--~---------~--~----~------------~-------~--~----~



Webview with progress and url overriding

by Mark Murphy » Fri, 09 Oct 2009 19:53:06 GMT


 


They are separate objects. What do you mean by "combined"?


What makes you say that? Is your WebChromeClient object being ignored?

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, $35/Year

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Webview with progress and url overriding

by cnordvik » Sat, 10 Oct 2009 04:13:24 GMT


 > What makes you say that? Is your WebChromeClient object being ignored?

Uh, well it seems like the website that I tested did a redirect so the
progress bar got a bit confused. It was working great actually. Just
thought the API was a bit strange with both a WebViewClient and a
WebChromeClient so I thought I did something wrong. Anyway, thanks for
replying to a confusing post :-)

-Christer
--~--~---------~--~----~------------~-------~--~----~



Webview with progress and url overriding

by Mark Murphy » Sat, 10 Oct 2009 04:21:24 GMT


 


Ah, yeah, redirects are somewhat annoying with WebView.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Looking for Android opportunities?  http://wiki.andmob.org/hado 

--~--~---------~--~----~------------~-------~--~----~