문제

I'm having trouble getting a Google Latitude location badge to display correctly in a WebView.

I am expecting something like this: http://dl.dropbox.com/u/4234644/Capture.JPG with a map image/photo.

But I am getting this: http://dl.dropbox.com/u/4234644/device-2011-08-16-203442.jpg without a map image/photo.

As you can see my location is being reported but I don't get the map or photo.

Here is my code: -

        AlertDialog.Builder aboutAlert = new AlertDialog.Builder(this);

        aboutAlert.setTitle("Expander Dip Switch Settings");

        aboutAlert.setIcon(R.drawable.icon);

        WebView browser = new WebView(this);

        browser.setBackgroundColor(0);

        String html = "<html><body><DIV ALIGN=CENTER><iframe src=\"http://www.google.com/latitude/apps/badge/api?user=4264905420631960930&type=iframe&maptype=roadmap&z=10\" width=\"150\" height=\"250\" frameborder=\"0\"></iframe></DIV></body></html>";

        browser.loadData(html, "text/html", "utf-8");

        aboutAlert.setView(browser);

        aboutAlert.setNeutralButton("Close", null);

        aboutAlert.show();

A simple url (maps.google.com) will display various screen elements but again no map.

Any ideas would be gratefully received.

Best regards

도움이 되었습니까?

해결책

Got it at last!

Needed to enable scripting.

   browser.getSettings().setJavaScriptEnabled(true);

Doesn't exactly leap out at you when looking at the badge html, oh well problem solved.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top