findViewbyId was added in API Level 1
findViewById: Look for a child CheckBox with the given id. If this view has a given id, return this CheckBox. The findViewById() method is available to all activities in Android. findViewById allows you to find a view inside an activity layout.
1. Name a CheckBox myCheckBox.
2. Declare a CheckBox named myCheckBox..
3. In MainActivity, java file, add the below code to the onCreate method. Where R.id.myCheckBox is the same as the android:id name in your main.xml file, and myCheckbox is the CheckBox name referred to in Java. This returns a CheckBox class and is casted to a CheckBox type so you can work with it.
myCheckBox = (CheckBox) findViewById(R.id.myCheckBox);
4. Compile and run!
Resources: