Progress bar while loading image using Glide

Edit: This is super simple now with the CircularProgressDrawable build.gradle implementation “androidx.swiperefreshlayout:swiperefreshlayout:1.1.0” MyGlideModule.kt @GlideModule class MyGlideModule : AppGlideModule() MainActivity.kt override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val circularProgressDrawable = CircularProgressDrawable(this) circularProgressDrawable.strokeWidth = 5f circularProgressDrawable.centerRadius = 30f circularProgressDrawable.start() GlideApp.with(applicationContext) .load(“https://raw.githubusercontent.com/bumptech/glide/master/static/glide_logo.png”) .placeholder(circularProgressDrawable) .into(a_main_image) } These are some other Glide snippets Old answer: You could also create a … Read more

Preload multiple images with Glide

Use the following code to cache images without displaying them using the downloadOnly method if you are looking to download images from the web and store them in the diskCache: FutureTarget<File> future = Glide.with(applicationContext) .load(yourUrl) .downloadOnly(500, 500); using preload method if you want to load them into the Memory Cache. Glide.with(context) .load(url) .preload(500, 500); You … Read more

Glide-4.0.0 Missing placeholder, error, GlideApp and does not resolve its method placeholder,error

Try using RequestOptions: RequestOptions requestOptions = new RequestOptions(); requestOptions.placeholder(R.drawable.ic_placeholder); requestOptions.error(R.drawable.ic_error); Glide.with(context) .setDefaultRequestOptions(requestOptions) .load(url).into(holder.imageView); EDIT If .setDefaultRequestOptions(requestOptions) does not work, use .apply(requestOptions): Glide.with(MainActivity.this) .load(url) .apply(requestOptions) .into(imageview); // or this Glide.with(MainActivity.this) .load(url) .apply(new RequestOptions().placeholder(R.drawable.booked_circle).error(R.drawable.booked_circle)) .into(imageview); // or this Glide.with(MainActivity.this) .load(url) .apply(RequestOptions.placeholderOf(R.drawable.booked_circle).error(R.drawable.)) .into(imageview); EDIT 2 Bonus Here are some other changes in Glide-4 How to use requestOptions.circleCropTransform(); How … Read more

Glide – javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found

The issue is about certificate follow this link –https://stackoverflow.com/a/39032433/4741746 This will bypass certificate and allow you to enter in system see this link also –https://futurestud.io/tutorials/glide-module-example-accepting-self-signed-https-certificates Create your custom GlideModule Class,OkHttpUrlLoader class and attach to you Glide as mention in above link You have to put <meta-data android:name=”io.futurestud.tutorials.glide.glidemodule.CustomImageSizeGlideModule” android:value=”GlideModule” /> Inside application tag of your AndroidMainifiest … Read more

How to round an image with Glide library?

Glide V4: Glide.with(context) .load(url) .circleCrop() .into(imageView); Glide V3: You can use RoundedBitmapDrawable for circular images with Glide. No custom ImageView is required. Glide.with(context).load(url).asBitmap().centerCrop().into(new BitmapImageViewTarget(imageView) { @Override protected void setResource(Bitmap resource) { RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), resource); circularBitmapDrawable.setCircular(true); imageView.setImageDrawable(circularBitmapDrawable); } });

Remove image from cache in Glide library

This is how I solved this problem. Method 1: When the URL changes whenever image changes Glide.with(DemoActivity.this) .load(Uri.parse(“file://” + imagePath)) .diskCacheStrategy(DiskCacheStrategy.NONE) .skipMemoryCache(true) .into(mImage); diskCacheStrategy() can be used to handle the disk cache and you can skip the memory cache using skipMemoryCache() method. Method 2: When URL doesn’t change, however, image changes If your URL remains … Read more

Local image caching solution for Android: Square Picasso, Universal Image Loader, Glide, Fresco?

Update Sep 2018: After several years, I needed the almost same thing for a local image caching solution. This time around, UIL has not been in active development. I compared the popular libraries, and the conclusion is pretty no-brainer: just use Glide. It’s much more powerful and configurable. Years ago I had to fork and … Read more