Issue
I have some drawable generated dynamically from material design icons
Drawable qq = new IconDrawable(context, FontAwesomeIcons.fa_qq).
colorRes(R.color.qq).sizeRes(R.dimen.button_height_normal);
I want to show this Drawable using Picasso but when try to load this Drawable get an error because Picasso load
accept only url for the Drawable and I can't get it or get it's Resource Id
.
there any way to make that ?
Solution
I've made a workaround as I've not seen the way to set directly a dynamically generated drawable. Picasso has the "error" and "placeholder" options that they both allow inputing a drawable so if you make the load to fail the Picasso will load the drawable (with you desired transformations, for instance):
Picasso.with(context).load("nothing").error(placeholder).placeholder(placeholder).into(this)
where placeholder is the drawable you want to load
Answered By - Marc MF
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.