4. Attributes and XML
• Attributes are properties of a view,
element and etc.
• Attributes are define by the XML
• XML is a Markup Language
Hello World!
Has many attributes
5. ID & References
• id is a unique resource name for the
element
• Can be use as references inside the code
6. Button and Methods
1
2
Click and hold
Drag and Drop
• Create a button then define the onClick
attribute of the button
• We will create a method for the button to
do something like disabling itself.
• Note the onclick defined name must be
same as the method name
Define the name
7. Logcats
• Logcat is a command-line tool that
dumps a log of system messages,
including stack traces when the device
throws an error and messages that you
have written from your app with the Log
class
8. Changing attributes
using methods
• We can create a object then cast it to the
view element.
• Then set some codes to change it
attributes, like the text, color, and etc.
9. R class and Find ID
• We can use findViewById to get the
reference ID and perform various attribute
changes
10. Getting Data
• Add a plain text and button views
• Create a method
• Create a variable for that specific view
and pass the data from the R class
• Then convert that data to string and
assign it to a variable
• Then running the app and log the
input
11. Making Toast
• An Android Toast is a small message
displayed on the screen
12. More learning Links
• Sample Demo project:
https://drive.google.com/file/d/14fLjvMdrWpI5tzCAvSOpVQdTqhg-
6BIv/view?usp=sharing
• Android Studio Documentation: https://developer.android.com/docs