Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com
So now we leave just Java behind and are gonna do it the way the Android creators want it to be, using XML files for layout and such.
R.layout.activity_main is the id referring to this layout file.
The R.java file contains generated code that you shouldn't touch. If you're curious, you can find it in your project's gen folder.
Again we use a LinearLayout as container and this XML code has been generated by the visual editor. At least I don't remember tweaking it, which you can of course do, if need be.
Its orientation has been set to vertical.
We use a Textview as a label , large font.
Find its already created instance.
A button is also defined in the XML file,...
with this id.
Find its instance.
Since findViewById returns a View reference, we need to cast to the proper type.
When the button is pushed, we change its colour...
and we change its container(LinearLayout)'s colour as well.
Disable the button...
and change the TextView's text.