I want to set an image which is from server as background of my editText.
It is easy to set background image when the image is from @drawable edit_text.setBackgroundResource(R.drawable.ic_launcher_background);
I'm using that to set the image from server:
Glide.with(img_1)
.load(API_BASE_URL+"img/post_wall_background_1.jpg")
.apply(RequestOptions.bitmapTransform(new RoundedCorners(15)))
.placeholder(R.drawable.shadow)
.into(img_1);
When user click on that image, I want to set it as the brackground of my editText.
How could I do that ?
I googled for hours but can not find anything about that.
AS suggested by @vikas kumar I tried that:
Glide.with(img_1)
.load(API_BASE_URL+"img/post_wall_background_1.jpg")
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
new_post_edit_text.setBackground(resource);
return false;
}
})
.into(img_1);
but not work.
Thanks alot.