I am working on an application that has google map in it. The default marker in the map is visible but what i have to do is to get a image from the facebook url and then show it on the google map. I am using "universal-image-loader-sample-1.8.6.apk" to load the images using the url.
Now to load a image i am doing this.
ImageLoader imageLoader;
imageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration ilc = ImageLoaderConfiguration.createDefault(this);
imageLoader.init(ilc);
ImageView imageView = (ImageView)findViewById(R.id.friend_pic);
imageLoader.displayImage(stringImageUrl, imageView);
The code is simple the displayImage() accepts two argument ,first is stringImageUrl (the url of the pic) second is imageView (ImageView object in the layout).
Now why i need the ViewImage object if i have to show image on map.Well ImageLoader object does not returns bitmap image from any of its function to first i used the ImageView to set the fetched image from url to imageview and then get the image in Bitmap.
What i did is something like this.
Drawable drawble = imageView.getDrawable();
BitmapDescriptor icon=BitmapDescriptorFactory.fromBitmap(((BitmapDrawable)drawble).getBitmap());
Once i got the image in the BitmapDescriptor , its easy to set it in marker.
Marker location = googleMap.addMarker(new MarkerOptions().visible(true)
.title(stringName).position(position).icon(icon);
but the problem is , THIS IS NOT WORKING.Image is coming in imageView object but not able to get it to Marker.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…