android - ButterKnife - bind drawable resource -
how eliminate following initialization code using butterknife annotations?
private drawable mexpanddrawable; private drawable mcollapsedrawable; void init() { mexpanddrawable = getresources().getdrawable(r.drawable.ic_expand_small_holo_light); mcollapsedrawable = getresources().getdrawable(r.drawable.ic_collapse_small_holo_light); }
use @binddrawable butterknife 7 api.
import butterknife.binddrawable; @binddrawable(r.drawable.ic_expand_small_holo_light) protected drawable mexpanddrawable; @binddrawable(r.drawable.ic_collapse_small_holo_light) protected drawable mcollapsedrawable; void init() { butterknife.bind(this); } there @bindstring, @bindint, @binddimen, @bindcolor, @bindbool other resource types.
Comments
Post a Comment