title: android parse URL in a webview
body: <p>i load a page in a webview and i want to parse the URL that is inside the webview.</p>
  
  <p>this is my code for load the page, using httppost.</p>
  
  <p>The URL is URL FEED: http:/www.ilias.de/docu/feed.php...........</p>
  
  <p>this code make a httppost request and execute the response then it shows the webpage into the webview.</p>
  
  <pre><code>public class ilias extends Activity {
  
   WebView webView;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          webView = (WebView)findViewById(R.id.webview);
  
          BufferedReader bufferedReader = null;
          HttpClient httpClient = new DefaultHttpClient();
          HttpPost request = new HttpPost("http://www.ilias.de/docu/login.php?client_id=docu");
          List&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
          postParameters.add(new BasicNameValuePair("username", "stacked")); //this username 
          postParameters.add(new BasicNameValuePair("password", "overflow"));//works
  
  
    try {
     UrlEncodedFormEntity entity = new UrlEncodedFormEntity(postParameters);
           request.setEntity(entity);
  
           HttpResponse response= httpClient.execute(request);
  
     bufferedReader = new BufferedReader(
             new InputStreamReader(response.getEntity().getContent()));
     StringBuffer stringBuffer = new StringBuffer("");
     String line = "";
     String LineSeparator = System.getProperty("line.separator");
     while ((line = bufferedReader.readLine()) != null) {
      stringBuffer.append(line + LineSeparator); 
     }
     bufferedReader.close();
  
     Toast.makeText(ilias.this, 
       "Finished", 
       Toast.LENGTH_LONG).show();
  
     String webData = stringBuffer.toString();
  
     webView.setWebViewClient(new WebViewClient()); 
     webView.getSettings().setJavaScriptEnabled(true);
  
     webView.loadDataWithBaseURL("http://www.ilias.de/docu/",webData,"text/html","UTF-8","about:blank");
     String postData = "username=stacked&amp;password=overflow";
     String url = "http://www.ilias.de/docu/login.php?client_id=docu";
  
    webView.postUrl(url, EncodingUtils.getBytes(postData, "base64"));
  
    webView.loadUrl("http://www.ilias.de/docu/ilias.php?col_side=left&amp;block_type=pdnews&amp;cmd=showFeedUrl&amp;cmdClass=ilpdnewsblockgui&amp;cmdNode=i7:db:le&amp;baseClass=ilPersonalDesktopGUI");
    webView.setWebViewClient(new WebViewClient() {
        public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
        handler.proceed() ;
        }
       });
  
    } catch (ClientProtocolException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
     Toast.makeText(ilias.this, 
       e.toString(), 
       Toast.LENGTH_LONG).show();
    } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
     Toast.makeText(ilias.this, 
       e.toString(), 
       Toast.LENGTH_LONG).show();
    }finally{
     if (bufferedReader != null){
      try {
       bufferedReader.close();
      } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      }
     }
    }
  
  
      }
  }
  </code></pre>