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?
Android applications have an automatically generated file called "R.java". Please explain its purpose.
E.g.
Duplicate: What is the concept behind R.java?
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.
R.java is where you have access to anything you have in your resources:
You can read more here.
R.java is autogenerated on build. It's content is based on the resource files (including layouts and preferences).
When you delete it, it gets recreated, but if you create your own, you will get into trouble as the build system will not be able to replace it.