5. WHAT IS MAINACTIVITY.JAVA | CHANGE TEXT-2 | ANDROID APP DEVELOPMENT. What is MainActivity.java| ChangeText -2
MainActvity.java is one of the most important file in Android Studio. It is inside this file you define methods, functions, datatypes and variables.
To complete the ChangeText app that we created in the previous video lets first define two datatype mainly TextView and Button.
The variable name for TextView is quote and that for Button is clk.
After declaring the Button and TextView we need to initialize them, So we initialize the Button and TextView and store the id of textview and button in variables quote and clk
So textview id is stored in quote.
And button id is stored in clk.
After the id’s are stored in variable we can then use then link the variables with respective methods.
In this video you will also see what setonclicklistiner method is and how setonclicklistiner method can be linked with a particular variable
We use the method changequote to check whether the button is clicked or not. If the button is clicked changequote method will be called and it will change the text inside TextView
Tags: 5. WHAT IS MAINACTIVITY.JAVA | CHANGE TEXT-2 | ANDROID APP DEVELOPMENT, MainActivity.java, ANDROID APP DEVELOPMENT, ANDROID TUTORIAL FOR BEGINEERS, WHAT IS ONCLICK MENTHOD, WHAT IS SETONCLICKLISTINER