Resource IDs and R.java
Every resource file gets an ID assigned by the Android build system.
The
gen
directory
in an Android project contains the
R.java
references file which contains these generated
values. These
references are static
integer
values.
If you
add a new
resource file, the corresponding
reference is
automatically
created in
R.java
file.
Manual changes in the
R.java
file are not
necessary and are overridden
by the
tooling.
The Android
system
provides
methods to access the
corresponding
resource files
via these IDs.
For
example to
access a
String with the
R.string.yourString
ID in your source code,
you would use the
getString(R.string.yourString))
method.
No comments:
Post a Comment