I followed this answer, But it showed up like this
and this is my code
String imageUrl = "https://m.media-amazon.com/images/M/MV5BYjRjMTA5YjAtMTNjYy00M2E0LTk0YWEtMjE4ZDI3MTdlZmZjXkEyXkFqcGdeQTNwaW5nZXN0._V1_.jpg";
Glide.with(getApplicationContext())
.asBitmap()
.placeholder(R.drawable.ic_profile)
.error(R.drawable.ic_profile)
.load(imageUrl)
.apply(
RequestOptions.circleCropTransform().placeholder(R.drawable.profile)
)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
Drawable bitmapDrawable = new BitmapDrawable(getResources(), resource);
mBinding.bottomNavigation.getMenu().findItem(R.id.nav_my_profile).setIcon(bitmapDrawable);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
note: my emulator is Android 7 and I tried it on a phone that contains Android 11, but it doesn't work
How can I create this feature?
note: I preferred
Java
, if itkotlin
no problem