@Retention(value=CLASS)
@Target(value=FIELD)
public @interface ViewById
Use it on View
or View
subtype
fields in a view related (ie EActivity
, EFragment
,
EViewGroup
, ...) annotated class.
The annotation value should be one of R.id.* fields. If not set, the field name will be used as the R.id.* field name.
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.myEditText @ViewById EditText myEditText; @ViewById(R.id.myTextView) TextView textView; @AfterViews void updateTextWithDate() { myEditText.setText("Date: " + new Date()); } }
AfterViews
Copyright © 2010-2014. All Rights Reserved.