@Retention(value=CLASS)
@Target(value=FIELD)
public @interface ViewsById
Use it on a List of View or View subtype
fields in a view related (ie EActivity, EFragment,
EViewGroup, ...) annotated class.
The annotation value should be an array of R.id.* fields.
Your code related to injected views should go in an AfterViews
annotated method.
Example :
@EActivity(R.layout.main)
public class MyActivity extends Activity {
// Injects R.id.edit1 and R.id.edit2 into the List.
@ViewsById({R.id.edit1, R.id.edit2})
List<EditText> myEditTexts;
@ViewsById({R.id.myTextView1, R.id.myOtherTextView})
List<TextView> textViews;
@AfterViews
void updateTextWithDate() {
for (TextView textView : textViews) {
textView.setText("Date: " + new Date());
}
}
}
AfterViewsCopyright © 2010-2014. All Rights Reserved.