Skip to content
Steven Lewi edited this page Jul 13, 2015 · 3 revisions

@ViewId can be used to bind any kind of view into variable. It has same functionality as findViewById().

Example

@ContentView(R.layout.activity_main)
public class MainActivity extends BaseActivity {

    @ViewId(R.id.title)
    private TextView title;

    @ViewId(R.id.message)
    private EditText message;

    @Override
    protected void onContentViewCreated() {
        // Access view without initialization using findViewById()
        title.setText("Send message:");
    }
}
Clone this wiki locally