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://maps.gstatic.com/mapfiles/place_api/icons/cafe-71.png";
final int stub_id = R.drawable.ic_action_search;
// ImageLoader class instance
ImageLoader imgLoader = new ImageLoader(getApplicationContext());
// whenever you want to load an image from url
// call DisplayImage function
// url - image url to load
// loader - loader image, will be displayed before getting image
// image - ImageView
imgLoader.DisplayImage(image_url,stub_id ,imV);
but it is displaying the default image,rather than Url downloaded image.
i m using infowindowAdapter class of goolge and its says that i cn't change the image when once data & image is loaded in the window,thts why its displaying first default image..... and not changing later
so is there any other way? thanks in advance
I'm having the same problem. I've solved it with a asyncTask.
Something like this
private Drawable _infoImageDrawable;
public class MyMapActivity extends MenuActivity
{
.....code code code....
protected void handleMarkerClicked(final Marker marker, final String url) {
new AsyncTask<Void, Void, Void>()
{
@Override
protected void onPreExecute()
{
super.onPreExecute();
_infoImageDrawable = null;
}
@Override
protected Void doInBackground(Void... params)
{
InputStream is;
try {
is = (InputStream) new URL(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();
}
return null;
}
@Override
protected void onPostExecute(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.
来源:https://stackoverflow.com/questions/14279442/i-my-using-google-mapv2-and-i-m-downloading-image-from-google-place-api-and-want