android – Take time to load image in imageview in custom info window adapter-ThrowExceptions

Exception or error:

I am using picasso to load the image in info window adapter but it take time to load in imageview . any one help me to load the image quickly on clicking on the marker.

How to solve:

You can use Fresco to load image quickly and while image is not loaded you can put placeholder so it will look good as compare to now.

###

Best Practices is if your images are too large then use Thumbnail images for faster loading in recyclerview.

(In webapi response there are two URL one is original images url and other is thumbnail(small) image url)

After clicking on image load original large images.

Hope this may help you 🙂

###

We have done it through glide .when glide callback return the response then show again info window and hide previous info window.
just using this code i complete it:

  Glide.with(getActivity())
                        .load(getMarkerDetails(marker).get("imageUrl"))
                        .listener(new RequestListener<String, GlideDrawable>() {
                            @Override
                            public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
                                return false;
                            }

                            @Override
                            public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                                if (marker.isInfoWindowShown()) {
                                    marker.hideInfoWindow();
                                    marker.showInfoWindow();
                                }
                                return false;
                            }
                        })
                        .into(img_profile);

Leave a Reply

Your email address will not be published. Required fields are marked *