When developing an application for Android you will require additional resources. This data is kept in resource files. The resource files live under the /res directory and consist of the following items:
- Colors
- Strings
- Dimensions
- Drawables (Images and Icons)
- Sounds
- Videos
- Data Files
- Layout Files
The Rules for resource files are:
- Must be lowercase
- May contain: letters, numbers, underscores and periods
- Filenames must be unique
- XML Name attributes must be unique as well
To reference the resources from a compiled resource you would use something like the following format depending on the type of resource:
String app_name = getResources().getString(R.string.app_name);
The template for reading resources is either:
Local
@[resource type]:/[resource name]
or Android
@android:[resource type]:[resource name]
or from a layout file:
@string/app_name
or from the android system resources:
@android:string/ok
Tags: android