-1

I'm using webview in android and when I call loadURL it does a call to the browser activity

I need to show the webcontent inside my own activity as I have other stuff to be viewed in it buttons, text, ,.. etc

Helal Ismail
  • 518
  • 1
  • 10
  • 22

1 Answers1

0

Use the WebView.setWebViewClient(WebViewClient) method ( http://developer.android.com/reference/android/webkit/WebView.html) and override the shouldOverrideUrlLoading(WebView, String) method like this:

webView.setWebViewClient(new WebViewClient() {                                      

    @Override                                                                       
    public boolean shouldOverrideUrlLoading(WebView view, String url) {             
        if ( url.equals( "http://www.example.com" ) ) {                                      
            // Do something
            return true;                                                            
        }                                                                           

        // If we couldn't match the URL, the following line
        // lets the webview use default behaviour (i.e. open browser)
        return super.shouldOverrideUrlLoading(view, url);                           
    }                                                                               

});                                                                                 
JesperB
  • 4,625
  • 1
  • 36
  • 40