When you use <Button></Button>
in your xml, you are creating a Button object (android creates it for you). When you use the methodfindViewById
you are obtaining a reference to the created Button
. So you can access public methods of the Button
class.