title: Get the WebView navigation event
body: <p>I am working in an android application that can post tweets to twitter and I am doing it with the Web View widget. If the user is not logged in it will go to the login screen and if it a logged-in user in it will go to the tweet page. My requirement is after twetting from my application it should <strong>return to my application</strong>. How can I handle this situation by WebView. How will I get the redirect url from my WebView.</p>
  
  <p>Please help me.</p>
  
  <p>Please look into my code:</p>
  
  <pre><code>public class TestTwittershareActivity 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);
          webview.getSettings().setJavaScriptEnabled(true);
          webview.loadUrl("http://www.twitter.com?status=");
          webview.setWebViewClient(new HelloWebViewClient());
      }
  
      public boolean onKeyDown(int keyCode, KeyEvent event) {
          if ((keyCode == KeyEvent.KEYCODE_BACK) &amp;&amp; webview.canGoBack()) {
              webview.goBack();
              return true;
          }
          return super.onKeyDown(keyCode, event);
      }
  
      private class HelloWebViewClient extends WebViewClient {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
              view.loadUrl(url);
  
              return true;
          }
      }
  }
  </code></pre>