获取URL,对URL更改执行操作并获取URL到ParentActivity

时间:2018-12-26 20:06:35

标签: android url webview

当URL为stackoverflow.com时,我正在获取URL并完成活动。如何将该URL传递给家长活动?

wvPayment.setWebViewClient(new WebViewClient(){

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
            Log.d(TAG, "shouldOverrideUrlLoading: "+String.valueOf(request.getUrl()));
            if(String.valueOf(request.getUrl()).equals("http://stackoverflow.com/")){
                finish();
                Toast.makeText(PaymentActivity.this ,"Successful",Toast.LENGTH_LONG).show();
            }
            return true;
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            wvPayment.setVisibility(View.GONE);
            ProgressBar.setVisibility(View.VISIBLE);
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            wvPayment.setVisibility(View.VISIBLE);
            ProgressBar.setVisibility(View.GONE);
        }
    });

0 个答案:

没有答案