{"action":"created","issue":{"url":"https://api.github.com/repos/bumptech/glide/issues/740","labels_url":"https://api.github.com/repos/bumptech/glide/issues/740/labels{/name}","comments_url":"https://api.github.com/repos/bumptech/glide/issues/740/comments","events_url":"https://api.github.com/repos/bumptech/glide/issues/740/events","html_url":"https://github.com/bumptech/glide/issues/740","id":116718629,"number":740,"title":"Load image to cache with Glide","user":{"login":"mdtuyen","id":10714532,"avatar_url":"https://avatars.githubusercontent.com/u/10714532?v=3","gravatar_id":"","url":"https://api.github.com/users/mdtuyen","html_url":"https://github.com/mdtuyen","followers_url":"https://api.github.com/users/mdtuyen/followers","following_url":"https://api.github.com/users/mdtuyen/following{/other_user}","gists_url":"https://api.github.com/users/mdtuyen/gists{/gist_id}","starred_url":"https://api.github.com/users/mdtuyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdtuyen/subscriptions","organizations_url":"https://api.github.com/users/mdtuyen/orgs","repos_url":"https://api.github.com/users/mdtuyen/repos","events_url":"https://api.github.com/users/mdtuyen/events{/privacy}","received_events_url":"https://api.github.com/users/mdtuyen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-13T07:40:15Z","updated_at":"2015-11-13T07:55:40Z","closed_at":null,"body":"I use Glide to load image to Marker google map (cluster):\r\n```\r\n  @Override\r\n        protected void onBeforeClusterItemRendered(final FeedsModel feedsModel, final MarkerOptions markerOptions) {\r\n            // Draw a single person.\r\n            // Set the info window to show their name.\r\n            Glide\r\n                    .with(mActivity.getApplicationContext())\r\n                    .load(feedsModel.getImages().getThumbnail().getUrl())\r\n                    .diskCacheStrategy(DiskCacheStrategy.ALL)\r\n                    .into(new SimpleTarget<GlideDrawable>() {\r\n                        @Override\r\n                        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {\r\n                            mImageView.setImageDrawable(resource);\r\n                            Bitmap icon = mIconGenerator.makeIcon();\r\n                            Marker markerToChange = null;\r\n                            for (Marker marker : mClusterManager.getMarkerCollection().getMarkers()) {\r\n                                if (marker.getPosition().equals(feedsModel.getPosition())) {\r\n                                    markerToChange = marker;\r\n                                }\r\n                            }\r\n                            // if found - change icon\r\n                            if (markerToChange != null) {\r\n                                markerToChange.setIcon(BitmapDescriptorFactory.fromBitmap(icon));\r\n                            }\r\n                        }\r\n                    });\r\n        }\r\n\r\n        @Override\r\n        protected void onBeforeClusterRendered(final Cluster<FeedsModel> cluster, final MarkerOptions markerOptions) {\r\n            // Draw multiple people.\r\n            // Note: this method runs on the UI thread. Don't spend too much time in here (like in this example).\r\n            final List<Drawable> profilePhotos = new ArrayList<Drawable>(Math.min(4, cluster.getSize()));\r\n            final int width = mDimension;\r\n            final int height = mDimension;\r\n\r\n            int i = 0;\r\n\r\n            for (final FeedsModel p : cluster.getItems()) {\r\n                // Draw 4 at most.\r\n                i++;\r\n                Glide\r\n                        .with(mActivity.getApplicationContext())\r\n                        .load(p.getImages().getThumbnail().getUrl())\r\n                        .diskCacheStrategy(DiskCacheStrategy.ALL)\r\n                        .into(new SimpleTarget<GlideDrawable>() {\r\n                            @Override\r\n                            public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {\r\n                                resource.setBounds(0, 0, width, height);\r\n                                profilePhotos.add(resource);\r\n                                MultiDrawable multiDrawable = new MultiDrawable(profilePhotos);\r\n                                multiDrawable.setBounds(0, 0, width, height);\r\n\r\n                                mClusterImageView.setImageDrawable(multiDrawable);\r\n                                Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize() > 99 ? \"99+\" : cluster.getSize()));\r\n                                markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));\r\n                            }\r\n                        });\r\n\r\n                if (i == 4) break;\r\n            }\r\n        }\r\n```\r\nBecause there are many picture I need load so that with above code, Some marker don't render to add image. Now, I want load image when onCreate() function but don't put to a imageview first. What is function can be use ?\r\n\r\n--------------------\r\n\r\nThanks,\r\nmdtuyen"},"comment":{"url":"https://api.github.com/repos/bumptech/glide/issues/comments/156356852","html_url":"https://github.com/bumptech/glide/issues/740#issuecomment-156356852","issue_url":"https://api.github.com/repos/bumptech/glide/issues/740","id":156356852,"user":{"login":"TWiStErRob","id":2906988,"avatar_url":"https://avatars.githubusercontent.com/u/2906988?v=3","gravatar_id":"","url":"https://api.github.com/users/TWiStErRob","html_url":"https://github.com/TWiStErRob","followers_url":"https://api.github.com/users/TWiStErRob/followers","following_url":"https://api.github.com/users/TWiStErRob/following{/other_user}","gists_url":"https://api.github.com/users/TWiStErRob/gists{/gist_id}","starred_url":"https://api.github.com/users/TWiStErRob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWiStErRob/subscriptions","organizations_url":"https://api.github.com/users/TWiStErRob/orgs","repos_url":"https://api.github.com/users/TWiStErRob/repos","events_url":"https://api.github.com/users/TWiStErRob/events{/privacy}","received_events_url":"https://api.github.com/users/TWiStErRob/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T07:55:40Z","updated_at":"2015-11-13T07:55:40Z","body":"I think what you want is to call `.diskCacheStrategy(ALL).preload(width, height)` for all your `FeedsModel`s.\r\nMake sure you also match the transformation defined by the `ImageView.scaleType` (`.centerCrop()`/`.fitCenter()`).\r\n\r\nBut that will probably just hide your issue: I think you need to re-request rendering of the cluster/item that finishes loading because Glide is async."}}