Open specific link in browser, but not in WebView - Eclipse Android -


i created app website: when open app shows me site in webview , links in site open in webview. there button on site link looks "http://www.domain.com/out/some-text". if clicks on link, link should open in default browser of android , not in webview.

here code:

public class webviewclientdemoactivity extends activity { /** called when activity first created. */  webview web; @suppresslint("setjavascriptenabled") @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);      web = (webview) findviewbyid(r.id.webview01);      web.setwebviewclient(new mywebclient());     web.getsettings().setjavascriptenabled(true);     web.loadurl("http://www.domain.com"); }  public class mywebclient extends webviewclient {       @override     public void onpagestarted(webview view, string url, bitmap favicon) {         // todo auto-generated method stub         super.onpagestarted(view, url, favicon);     }      @override     public boolean shouldoverrideurlloading(webview view, string url) {         // todo auto-generated method stub          view.loadurl(url);         return true;      }      @override     public void onpagefinished(webview view, string url) {         // todo auto-generated method stub         super.onpagefinished(view, url);      } }  // handle "back" key press event webview go previous screen. @override public boolean onkeydown(int keycode, keyevent event)  {     if ((keycode == keyevent.keycode_back) && web.cangoback()) {         web.goback();         return true;     }     return super.onkeydown(keycode, event); } // inflate menu         @override         public boolean oncreateoptionsmenu(menu menu) {            menuinflater inflater = getmenuinflater();            inflater.inflate(r.menu.option, menu);            return true;         }          // handle click events         @override         public boolean onoptionsitemselected(menuitem item) {            switch (item.getitemid()) {            case r.id.add:               toast.maketext(this, "android app v1.1", toast.length_short).show();               return true;            case r.id.help:                finish();                system.exit(0);               return true;             default:               return super.onoptionsitemselected(item);         }         } } 

how can that?

thx

try:

startactivity(new intent(intent.action_view, uri.parse(url))); 

into "shouldoverrideurlloading".


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -