In Android applications what is the role of "R.java"?

pawarrohit14 picture pawarrohit14 · Jul 28, 2012 · Viewed 28.9k times · Source

Android applications have an automatically generated file called "R.java". Please explain its purpose.

E.g.

  • What is contained in it?
  • What generates it?

Duplicate: What is the concept behind R.java?

Answer

jeet picture jeet · Jul 28, 2012

Every application uses resources such as strings, drawbles, layouts, and styles. Instead of hard coding such resources into an application, one externalizes them and refers to them by ID. The R.java file contains all those resource IDs, whether assigned by the programmer or generated by the sdk.