I am fetching countries' flag using a RestFul api, images are in svg formate so glide does not support svg format.
Glide.with(context)
.load(countriesListObj.getFlag())
.apply(RequestOptions.circleCropTransform())
.into(holder.countryFlag);
I found other solutions for the svg
GlideToVectorYou
.init()
.with(this)
.withListener(new GlideToVectorYouListener() {
@Override
public void onLoadFailed() {
Toast.makeText(context, "Load failed", Toast.LENGTH_SHORT).show()
}
@Override
public void onResourceReady() {
Toast.makeText(context, "Image ready", Toast.LENGTH_SHORT).show()
}
})
.setPlaceHolder(placeholderLoading, placeholderError)
.load(IMAGE_URL, imageview);
here is another way
SvgLoader.pluck()
.with(activity))
.setPlaceHolder(R.mipmap.ic_launcher, R.mipmap.ic_launcher)
.load("http://www.clker.com/cliparts/u/Z/2/b/a/6/android-toy-h.svg", image);
I have found other too, but every method is passing Activity
(.with(activity)))
and in glide we pass context. I am casting context to activity as
(Activity) context;
but it shows error
java.lang.NoSuchMethodError: No static method buildStreamModelLoader(Ljava/lang/Class;Landroid/content/Context;)Lcom/bumptech/glide/load/model/ModelLoader; in class Lcom/bumptech/glide/Glide; or its super classes (declaration of 'com.bumptech.glide.Glide' appears in /data/app/com.abc.online-NgaithsDmCnw4eJKDV789==/split_lib_dependencies_apk.apk)