Skip to content

Instantly share code, notes, and snippets.

@snadjafi
Created July 22, 2014 19:56
Show Gist options
  • Save snadjafi/dd7748f1e3b51d33c7bd to your computer and use it in GitHub Desktop.
Save snadjafi/dd7748f1e3b51d33c7bd to your computer and use it in GitHub Desktop.
custom view with butterknife exmaple
public class PhotoQuestionAnswer extends FrameLayout {
@InjectView(R.id.photo) PicassoImageView photoIv;
public PhotoQuestionAnswer(Context context) {
this(context, null);
}
public PhotoQuestionAnswer(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public PhotoQuestionAnswer(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
private void init() {
LayoutInflater.from(getContext()).inflate(R.layout.view_photo_question_answer, this, true);
ButterKnife.inject(this);
}
public void setImageBitmap(Bitmap bm) {
photoIv.setImageBitmap(bm);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment