2011-08-18 57 views
0

我使用webview在我的android上进行paypal付款。付款实际上发生在服务器上,我只是上传到我的webview的网址。当付款完成后,我将浏览器重定向到一个页面。这工作正常。但我想要的是当页面被重定向到这个成功页面时,我应该能够开始新的活动。我正在使用下面的方法,但它无法获得成功的URL。当URL变化时获取webview的URL

_webView.setWebViewClient(new WebViewClient() 
      { 
       public boolean shouldOverrideUrlLoading(WebView view, String url) 
       { 
        //Our servlet only uses one url for both success or failure 
        if (url.trim().equals("http://www.MyDomain.com/MobilePaypal/ReturnPage.aspx")) 
        { 
         Intent iPrintReciept = new Intent(getApplicationContext(), PrintReciept.class) ; 
         //Intent iPrintReciept = new Intent(Payment.this,PrintReciept.class); 
         startActivity(iPrintReciept); 

        } 
        return false; 
       } 
      }); 

回答

0

如果你的工人阶级是一个活动,然后使用如下

Intent iPrintReciept = new Intent(yourActivityName.this, PrintReciept.class); 

如果你的工人阶级是不活动使用答复问题不留

Intent iPrintReciept = new Intent(context,PrintReciept.class); 
+0

jainal感谢名单活动。问题是,当webview加载url我想跟踪url的,这样,当http://www.MyDomain.com/MobilePaypal/ReturnPage.aspx加载我可以开始上面的活动 – user833178