inmite / android-validation-komensky

A simple library for validating user input in forms using annotations.
Apache License 2.0
508 stars 78 forks source link

can't use in viewholder #28

Closed palize closed 9 years ago

palize commented 9 years ago

I usually like it in my viewholder. But it does not seem possible in viewholder.

static class creditViewHolder { @InjectView(R.id.txtcredit) TextView txtcredit; @InjectView(R.id.btncredit) Button btncredit;

    @NotEmpty(messageId = R.string.creditnotempty)
    @MinValue(value = 1, messageId = R.string.creditminvalue)
    @InjectView(R.id.editprice)
    EditText editprice;
    @InjectView(R.id.btnok)
    Button btnok;
    @InjectView(R.id.pricelayout)
    LinearLayout pricelayout;

    creditViewHolder(View view) {
        ButterKnife.inject(this, view);
    }

}

how do i validate viewholder?

tomas-vondracek commented 9 years ago

this shouldn't be a problem, just call

FormValidator.validate(context, viewholder, callback)