The “Values” Folder

While developing Android Applications, one inevitably comes across the Values folder. It is located in <workspace>-><application name>->res. It holds some very important and interesting resources which I am going to tell you about in this post.

  • The strings.xml file is already present when you create a new Application Project in Eclipse. It holds the important strings with their ids. ┬áThe manifest file contains the android:label attribute of the application set to @string/app_name. app_name is the id which holds your application name. Similarly it also contains the android:style attribute set to @string/AppTheme. The strings.xml file provides a way to use the same string values in multiple places throughout the application.
  • In the newer versions of Eclipse the dimens.xml file is also present on the creation of a new application project. It holds the dimensions again mapped with ids. The file on creation already contains commands that use the dimensions in dimens.xml file.
  • One can also create xml files in the values folder. The snippet below shows a colors.xml I creates to use in one of my applications. Like the ones described above it contains the hex code of colors mapped with ids.
  • The below snippet shows styles.xml file. Depending on the version of the SDK and Eclipse, it might or might not be created on the creation of a new Application project. It contains various styles for layouts.
  • Remember, that above are just the xml files from one of my applications. You can create any number of xml files to suit your needs. All the values and resources inside them will be accessible from each module of your application.

As you are now familiar with most of the Android Development techniques, you will often require to change and modify the values folder. Keep experimenting!!

Leave a Comment

Your email address will not be published. Required fields are marked *