Reputation: 737
Maybe this is a really dumb question, but I went through a part of the R.java file. There I saw a mp3 file of my raw folder. It was named:
public static final int sound01=0x7f040000;
Why is a sound file passed as an integer? Is that just that they give the file a number, and then Android uses that number as a reference?
Thanks in advance!
Upvotes: 0
Views: 87
Reputation: 134714
This is just like any other reference that you access through R
(e.g. R.string.x
, R.dimen.x
). You can access your files in raw through R.raw.x
(so in this case, R.raw.sound01
). The integer is just a guaranteed unique identifier for that particular resource.
Upvotes: 1