Button
and TextView
are class names. When I type:
private Button myButton;
I create a reference to an object of type button that points to an empty address location.
If I then instantiate an object as follows:
myButton = new Button();
myButton will refer to a newly created Button
object in the program’s memory.
For android, or any Java Swing, Button
objects simply mean buttons in your GUI interface. While TextView
is a text field that displays.. you guessed it.. text.
In your case, the Button
is something you already have in your XML file describing your GUI, so you point to that button in your object by using findViewById(..)
.
Regarding this
, it refers to an object of the class that you are in. So whenever I instantiate an object of type Spritkostenactivity
, there will be a button listening to clicks on this
object (any instance of Spritkostenactivity
) due to the statement buttonstop.setOnClickListener(this)
.
Double
is the class name of the data type that holds a double-precision floating point number, parseDouble
is a function that takes a string and formats it into a double
number.
1
solved Beginner:What do several parts of my code mean? [closed]