title: android - how to get WebView URL address
body: <p>i am trying to compare URL in if condition</p>
  
  <p>i have following code but its doesn't work simply crash on app loading</p>
  
  <pre><code>    i am getting error when i put this code in
  
              String webUrl = web.getOriginalUrl();
  </code></pre>
  
  <p>here is full code</p>
  
  <pre><code>    //loading website
      setContentView(R.layout.main);
      web = (WebView) findViewById(R.id.webView1);
      setUpWebView();
      web.loadUrl("http://www.domain.com");
  
      String webUrl = web.getOriginalUrl();
  
      if (webUrl.equals("http://www.domain.com"))
       {
        //do something
       }
  </code></pre>
  
  <p>thanks for your help.</p>