Button




A Button object represents a clickable Button on the screen.

Example:

< Button
   android:id="@+id/swimmersButton"
   android:onClick = "swimmersButtonClick"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_span="3"
   android:text="Swimmers"
/>

You can declare a reference to the Button in code.
You only need a reference if you need to refer to the Button.

private Button swimmersButton;


You can get a reference to it by calling findViewById
You usually do this in the onCreate method

swimmersButton = (Button) findViewById(R.id.swimmersButton);



// Click event in Java code
public void swimmersButtonClick(View v)
{
   // do whatever
}