Android tutorial - Android Button - android app development - android studio - android development tutorial
Learn android - android tutorial - Android button - android examples - android programs
- Android Button represents a push-button. The android.widget.Button is subclass of TextView class and CompoundButton is the subclass of Button class.
- There are different types of buttons in android such as RadioButton, ToggleButton, CompoundButton etc.
- Here, we are going to create two textfields and one button for sum of two numbers. If user clicks button, sum of two input values is displayed on the Toast.
Add Button
- Open “res/layout/main.xml” file, add a button.
File : res/layout/main.xml
2. Code
- Attach a click listener to the button.
- When user click on it, open mobile browser and display
2. Code URL : https://www.wikitechy.com. File : MyAndroidAppActivity.java
Demo - android emulator - android tutorial
- Run the application.
- Result, a normal button.
- Click on the button, display URL in browser.