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

Manage string values as resources - Android Tutorial

From the course: Android Development Essential Training: 2 User Interface Design

Start my 1-month free trial

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…

Contents