Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Owner and Founder. Opencart
Top Partners
In this blog, you know how to add URL image marker in Google Map.
It is a tough task to add URL Image to Marker. I use Picasso Library to parse image, for getting more about Picasso library see my other blog. Before knowing to add a marker in Map. You should check In your Manifest file having google map API.
<fragment>
activity_maps.xml
SupportMapFragment
GoogleMap
2. In your activity’s methodonCreate(), set the layout file as the content view. Get a handle to the map fragment by calling.FragmentManager.findFragmentById() Then use getMapAsync() to register for the map callback:
onCreate()
FragmentManager.findFragmentById()
getMapAsync()
3. Implement the OnMapReadyCallback interface and override the onMapReady() method, to set up the map when the GoogleMap object is available:
OnMapReadyCallback
onMapReady()
Now I am describing, how to URL image load with Marker. Create a CustomTarget class that implement Target Interface, and load the bitmap to Marker via BitmapDescriptorFactory. The main issue comes when we add multiple Markers and load maker image from URL because of Picasso load image take some time rapidly we add a marker in a loop so some marker is not displayed. How you fix that issue, you create multiple Target object instance and add them to the List for each Marker.
For more About Picasso.
Picasso Library Use for Image Loading in Android
References: https://developers.google.com/maps/documentation/android-sdk/map-with-marker
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
For a Single marker
Picasso.with(this).load("Your Image URL").into(new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) { Marker marker = mGooglemap.addMarker(new MarkerOptions() .anchor(0.0f, 1.0f) // Anchors the marker on the bottom left .icon(BitmapDescriptorFactory.fromBitmap(bitmap)) .position(latLng)); marker.setTag(position); vendorMarker.add(marker); }
@Override public void onBitmapFailed(Drawable drawable) { } @Override public void onPrepareLoad(Drawable drawable) { } } );
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.
Stathis Plakidas
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.