开发者

Problem displaying Google Latitude location badge in Android WebView

I'm having trouble get开发者_开发技巧ting 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜