Working With EditText,Button,TextView in Android – UI Widgets


Working with EditText ,TextView and Buttons is simple as simple in Java. How to get values from EditText and how to set OnClickListener to Our Button and set on TextView is simple.How? Lets code –

Download Code

1). First of all create new project and then open its activity_main.xml file and take two Edittext ,TextView with one Button .

2). Now I’am going to show you how to get values from EditText and Onclick of Button and will Toast those Strings and also set those values over TextView.


Result –


Now file what we have to do is get the values from  EditText via e1.getText() method where e1 is our EditText etc. And set onClickListener on button b1.

Output –


You can customize your java code according to your need like if you want to take this string values from one Activity to another Activity you can use Intent .

For more Queries and if you found any bug do Post here . Happy Coding nerds :p