Skip to content Skip to sidebar Skip to footer

I My Using Google Mapv2 And I M Downloading Image From Google Place Api And Want To Display In The Popup

i m using all the classes for geting image through Url. ImageView imV= ((ImageView) view.findViewById(R.id.badge)); // Image url String image_url = 'http:/

Solution 1:

I'm having the same problem. I've solved it with a asyncTask.

Something like this

privateDrawable _infoImageDrawable;
publicclassMyMapActivityextendsMenuActivity
{
    .....code code code....

    protectedvoidhandleMarkerClicked(final Marker marker, final String url) {
        newAsyncTask<Void, Void, Void>()
        {   
            @OverrideprotectedvoidonPreExecute() 
            {
                super.onPreExecute();
                _infoImageDrawable = null;
            }

            @OverrideprotectedVoiddoInBackground(Void... params) 
            {
                InputStream is;
                try {
                     is = (InputStream) newURL(url).getContent();
                     _infoImageDrawable = Drawable.createFromStream(is, "");
                } catch (MalformedURLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                }
                returnnull;                
            }

            @OverrideprotectedvoidonPostExecute(Void result) 
            {
            super.onPostExecute(result);
            marker.showInfoWindow();
            }
        }.execute();
    }
}

Then I just set the drawable in the InfoWindowAdapter to null first(remove old image) and to _imageInfoDrawable second. It works - but i would like a better solution.

Post a Comment for "I My Using Google Mapv2 And I M Downloading Image From Google Place Api And Want To Display In The Popup"