0

To the webview I write the html5 and javascript,jquery related code.Below code is set the info window to marker.Please tell me what will be the wrong in this code .

map.setInfoWindowAdapter(new InfoWindowAdapter() {
                                    @Override
                                     public View getInfoWindow(Marker arg0) {
                                        return null;
                                    }

                                    @Override
                                    public View getInfoContents(Marker arg0) {
                                        View v = getLayoutInflater().inflate(R.layout.popups,
                                                null);
                                        WebView webView = (WebView) v
                                                .findViewById(R.id.webview_popup);
                                        TextView open = (TextView) v
                                                .findViewById(R.id.open_popup);

                                        webView.getSettings().setJavaScriptEnabled(true);

                                        webView.loadDataWithBaseURL("file:///android_asset/",objectValue.trim(),
                                                "text/html", "utf-8", null);
                                        open.setText("Open");
                                        return v;
                                    }
                                });

here objectValue means Html5 type string

Surekha
  • 1
  • 2
  • Kindly go to [http://stackoverflow.com/questions/15989891/android-setinfowindowadapter-with-webview-in-google-marker-api-v2?rq=1](http://stackoverflow.com/questions/15989891/android-setinfowindowadapter-with-webview-in-google-marker-api-v2?rq=1) – M D May 21 '14 at 07:37
  • Ok,thanks.how to convert the webview to imageview if webview is not supported – Surekha May 21 '14 at 09:26

1 Answers1

1

In google map android info window is not an actual android view component. how it works is when you return view from getInfoContent it basically render the view to image and put that image in the infowindow, so in your case when u return webview map will draw it on image mostly the webview will be empty that time ( it wont get time to load and parse and render html content to internal canvas ) so when map render it will be an empty webview. see the reference docs call it a not a live view https://developers.google.com/maps/documentation/android/infowindows#custom_info_windows

nizammoidu
  • 2,074
  • 1
  • 14
  • 14