--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
--- Begin Message ---Hi Pedro! You configure your mail app, for forward all messages?Check this please, because i am receiving a big number of messages from pe...@isr.uc.pt. Regards! On Mon, Sep 14, 2009 at 2:49 PM, Pedro Fernandes <pe...@isr.uc.pt> wrote: > > --~--~---------~--~----~------------~-------~--~----~ > 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<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -~----------~----~----~----~------~----~------~--~--- > > > > > --~--~---------~--~----~------------~-------~--~----~ > 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<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -~----------~----~----~----~------~----~------~--~--- > > > It seems like what you want to happen is this: > - if domain of URL is http://photics.com, display result in your webview > - if it is not http://photics.com, go to the URL in a new window > > I think the answer is in this thread. I don't trust your solution. I > don't understand why it would work twice. > Try going to an external URL and then to photics.com It looks to me like > the second access will have the WebViewClient set to null, so I don't see > how your photics logic will be called. > > Mark Murphy provided an answer referring to starting a new activity. I > think the answer is there. > If you override shouldOverrideUrlLoading: > - false means that the WebViewClient should display the contents of > the URL (just load photics.com please) > - true means that the code is handling it and you want something else > to happen. (I've got this) > > How to open a browser with an intent and activity. > See the nice article here: > http://www.androidcompetencycenter.com/2009/08/view-site-in-a-new-windowbrowser/ > > Intent viewIntent = *new* Intent(“android.intent.action.VIEW”, Uri.*parse > *("http://twitter.com/CarmenDelessio")); > startActivity(viewIntent); > > Putting it together, your code should do something like: > > public boolean shouldOverrideUrlLoading(WebView view, > String url) > { > if (url.contains("http://photics.com")) { > return false; > }else{ > //url being called was passed to override > shouldOverrideUrlLoading > > Intent viewIntent = *new* Intent(“android.intent.action.VIEW”, > Uri.*parse*(url)); > startActivity(viewIntent); >> >> return true; >> } > > > Caveat - I haven't tested this. > > Another method I have overridden is: onPageStarted (WebView view, String > url, Bitmap favicon) > It seemed to be that onPageStarted was always called, but that there were > cases when shouldOverrideUrlLoading was not. > Might want to test that by logging what is called. > > Carmen > http://www.twitter.com/CarmenDelessio > > > > On Mon, Sep 14, 2009 at 11:22 AM, Photics <m...@photics.com> wrote: > >> >> OK... first... a correction in my previous post. >> >> "every link opens in a new window" ...the word "external" should have >> been added. Local files can work great. My problem is that I'm trying >> to create exceptions. I have to do this to make my advertisers happy. >> >> So OK... I have a fix... it's ugly... but it seems to work. >> >> mWebView.loadUrl("http://photics.com/games/conquest"); >> mWebView.getSettings().setCacheMode >> (WebSettings.LOAD_NO_CACHE); >> mWebView.setWebViewClient(new WebViewClient() { >> public boolean shouldOverrideUrlLoading(WebView view, >> String url) >> { >> if (url.contains("http://photics.com")) { >> return false; >> } >> else mWebView.setWebViewClient(null); >> return false; >> } >> >> I seem to have the solution to my problem, but I'm not happy that I >> don't exactly understand how I did it. It seems incredibly odd to me >> that returning "false" twice worked. :-) >> >> I'm going to investigate this some more before I publish my app. >> >> > > --~--~---------~--~----~------------~-------~--~----~ > 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<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -~----------~----~----~----~------~----~------~--~--- > > >
--- End Message ---