@Retention(value=CLASS) @Target(value={FIELD,METHOD,PARAMETER}) public @interface ViewsById
Use it on a List of View or
View subtype fields or methods with applicable
parameters 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;
@ViewsById({ R.id.edit1, R.id.edit2 })
void singleInjection(List<EditText> myEditTexts) {
// do stuff
}
void multiInjection(@ViewsById({ R.id.edit1, R.id.edit2 }) List<EditText> myEditTexts, @ViewsById({ R.id.myTextView1, R.id.myOtherTextView }) List<TextView> textViews) {
// do stuff
}
@AfterViews
void updateTextWithDate() {
for (TextView textView : textViews) {
textView.setText("Date: " + new Date());
}
}
}
AfterViewspublic abstract int[] value
public abstract String[] resName
Copyright © 2010–2020 simpligility technologies inc.. All rights reserved.