title: want to redirect webview to other intent when url loading has finished in webview android
body: <p><strong>I want to redirect webview to another activity when url loading has
   completed. This is my code for webview :- this class is extended by webview</strong></p>
  
  <pre><code>   **   1)  This the method where I am doing code for redirecting webview to activity**
  </code></pre>
  
  <p><strong>> This is onPagefinished method where url is loading.</strong></p>
  
  <pre><code>            public void onPageFinished(WebView view, String url) {
                  if (url.endsWith("paymentconfirmation/"))
                      ((DibsPaymentScreen) getContext())
                              .setCancelDisallowed(false);
                  if (callbackUrl.equals(url)
                          &amp;&amp; statusCancelled.equals(paymentData.params
                                  .get(statusKey))) {
                      paymentResultListener.cancelUrlLoaded();
                  } else if (callbackUrl.equals(url)
                          &amp;&amp; statusAccepted.equals(paymentData.params
                                  .get(statusKey))) {
                      paymentResultListener.paymentAccepted(paymentData.params);
  
                  } else if (!windowIsLoaded) {
                      paymentWindowLoaded();
  
                  }
  
                  super.onPageFinished(view, url);
              }
  
                          public boolean shouldOverrideUrlLoading(WebView view, String url) {
  
                              if (url.equals("http://nmotion.dk/paymentconfirmation/")) {
                                  Intent intent = new Intent(getContext(),
                                  RestaurantsListScreen.class);
                              intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                          getContext().startActivity(intent);
                                  return true;
                              }
                              return false;
  }
  </code></pre>