0

I am loading check string inside a webview

String Check = "<html><body><form action=\"https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/**ID**\" id=\"BB_BuyButtonForm\" method=\"" +
            "post\" name=\"" +"BB_BuyButtonForm\" target=\"_top\">"
            +"<input name=\"item_name_1\" type=\"hidden\" value=\"Carbon Emission\"/>"
            +"<input name=\"item_description_1\" type=\"hidden\" value=\"Pay for carbon emission. \"/>"
            +"<input name=\"item_quantity_1\" type=\"hidden\" value=\"1\"/>"
            +"<input name=\"item_price_1\" type=\"hidden\" value=\"ffff\"/>"
            +"<input name=\"item_currency_1\" type=\"hidden\" value=\"USD\"/>"
            +"<input name=\"_charset_\" type=\"hidden\" value=\"utf-8\"/>"
            +"<input alt=\"\" src=\"https://sandbox.google.com/checkout/buttons/buy.gif?merchant_id=**ID**&amp&w=117&amp&h=48&amp&style=trans&amp&variant=text&amp&loc=en_US\" type=\"Button\"/>"
            +"</form></body></html>";

Then i loading check string to webview

        webview.loadData(Check, "text/html", "UTF_8");

Its showing white screen

3 Answers 3

3

Thank you very much to Nappy and Sandy.

Finally i solved my problem.It was because of secure url https .This will not run in webview directly so we have to avoid the ssl error

webview.setWebViewClient(new WebViewClient(){

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            pd.dismiss();
        }

        @Override
        public void onReceivedSSLError(WebView view, int errorCode,
                String description, String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);                 
      view.proceed();
        }

    });
Sign up to request clarification or add additional context in comments.

Comments

1

You will probably want to change

setInitialScale(1);

to

setInitialScale(100);

because the parameter expects a per cent value.

Comments

1

Create a Class like following

import android.webkit.WebView;
import android.webkit.WebViewClient;

public class HelloWebViewClient extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;
    }
}

Then add this statement

webView.setWebViewClient(new HelloWebViewClient());

after

webview.loadUrl(authUrl);

2 Comments

yes i have added already,as i am creating linked integration so i have added it priviously

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.