Skip to content
tylertreat edited this page Dec 31, 2012 · 2 revisions

The InjectView annotation is used to indicated that the annotated field is to be injected with an Android View. This is essentially a replacement for calling findViewById in your Activity's onCreate method.

The value attribute corresponds to the ID of the View` to inject.

InjectView Example

public class MyActivity extends InfinitumActivity {

    @InjectView(R.id.my_button)
    private Button mMyButton;

    @InjectView(R.id.my_checkbox)
    private CheckBox mMyCheckBox;

    @InjectView(R.id.my_textview)
    private TextView mMyTextView;

    // ...

}

Clone this wiki locally