Pregunta

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

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top