From the course: Android Development Essential Training: 2 User Interface Design
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Manage string values as resources - Android Tutorial
From the course: Android Development Essential Training: 2 User Interface Design
Manage string values as resources
- [Instructor] Android apps rely on static assets like images, colors, and strings. The static items are stored in your app as resources. These are all string resources. Each of them has a unique name that allows us to access it from our code or XML layout files. We define the names and values of string resources inside of the strings.xml file. This is how we would define the string resource for our Buy Now label. Notice that we have a special tag string and that tag has an attribute name, where we specify the name that we want to use to access this resource later. Then the contents of the tag is the actual value we want, Buy Now. And finally, we end with a matching closing tag. Let's look at one more example before we try this out in Android Studio. To use this aqua color in our application, we'd need to create a resource for it. To do that, we'd add a new definition to the colors.xml file, similar to what we did…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Manage string values as resources4m 18s
-
(Locked)
Manage data entry with EditText8m 31s
-
(Locked)
Manage data entry with TextInputLayout5m 51s
-
(Locked)
Use string resources with placeholders4m 2s
-
(Locked)
Display Snackbar messages3m 16s
-
(Locked)
Challenge: Get to know you1m
-
(Locked)
Solution: Get to know you2m 39s
-
(Locked)
-
-
-