How to Declare a Button, in Java

Button was added in API Level 1
Represents a push-button widget. Push-buttons can be pressed, or clicked, by the user to perform an action.

1. Add the below import to the imports section.

import android.widget.Button;

2. Add the below line to the onCreate method. This will create a new Button object named myButton.

Button myButton;

3. Compile and run!

Next Recommended Article: findViewById - How to Find a Button using ID

Resources:
developer.android.com/reference/android/widget/Button.html