WebView displays a question mark in a blue box

I have a WebView that displays the Google Checkout payment button in html form.

When I run it on the emulator, it works, there is a payment button, and I can click it and go to the Google verification web page.

However, when I run it on the Android 2.2 device itself, it just shows a small blue box with a question mark.

what does it mean?

String header = "<html>" + "<head>" + "<script language=\"javascript\">"+ "function pass() {"+ "return checkboxState.checkboxPass();"+ "}"+ "</script>" + "</head>" + "<body>"; String formData = "<center>"+ "<form onSubmit=\"return pass();\" action=\"https://"+host+"api/checkout/v2/checkoutForm/Merchant/"+merchantId+"\" id=\"BB_BuyButtonForm\" method=\"post\" name=\"BB_BuyButtonForm\" target=\"_blank\">"+ "<input name=\"item_name_1\" type=\"hidden\" value=\""+item_name_1+"\"/>"+ "<input name=\"item_description_1\" type=\"hidden\" value=\""+item_name_1+"\"/>"+ "<input name=\"item_quantity_1\" type=\"hidden\" value=\"1\"/>"+ "<input name=\"item_price_1\" type=\"hidden\" value=\""+item_price_1+"\"/>"+ "<input name=\"item_currency_1\" type=\"hidden\" value=\""+item_currency_1+"\"/>"+ "<input name=\"_charset_\" type=\"hidden\" value=\"utf-8\"/>"+ "<input type=\"hidden\" name=\"shopping-cart.items.item-1.merchant-private-item-data\" value=\""+private_item_data+"\">"+ "<input alt=\"Pay With Google Checkout\" src=\"https://"+host+"buttons/buy.gif?merchant_id="+merchantId+"&amp;w=121&amp;h=44&amp;style=trans&amp;variant=text&amp;loc=en_US\" type=\"image\"/>"+ "</form>"+ "</center>"; String footer = "</body></html>"; if(Logging.DEBUG) Log.d(TAG, header+formData+footer); browser = new WebView(ActivityActivate.this); browser.setBackgroundColor(0); browser.getSettings().setJavaScriptEnabled(true); browser.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); browser.getSettings().setSupportZoom(false); browser.addJavascriptInterface(new JavascriptInterface(), "checkboxState"); browser.loadData(header+formData+footer, "text/html", "UTF-8"); llPaymentButtons.addView(browser); 
+7
android webview
source share
2 answers

Well, I changed it to use loadDataWithBaseURL and it worked ... still not sure why. Can someone clarify?

 //browser.loadData(header+formData+footer, "text/html", "UTF-8"); browser.loadDataWithBaseURL("https://checkout.google.com", header+formData+footer, "text/html", "UTF-8", null); 
0
source share

try this apparently if the webview has no focus, this happens

  webView.requestFocus(View.FOCUS_DOWN); 
-one
source share

All Articles