Do the values in R.java ever change during runtime or between runs?
android
Solution
Neither, they're changed between compilations.
R is a class that is generated automatically during the build process of the application. Then compiled and serves as a normal class in your application.
From Android docs - Accessing Resources:
When your application is compiled, aapt generates the R class, which contains resource IDs for all the resources in your res/ directory. For each type of resource, there is an R subclass (for example, R.drawable for all drawable resources) and for each resource of that type, there is a static integer (for example, R.drawable.icon). This integer is the resource ID that you can use to retrieve your resource.
Problem
I'm designing a method for storing some values in a SharedPreferences that relate to a set of Views. The method is going to be run by a bunch of subclasses, so I need a simple way to store the names of the preferences, and I'm considering using the R.id values for the views, since I already have them in an ArrayList for another method. I'm a bit concerned however that those values might change between runs, which would effectively invalidate the stored preferences. Do they ever change outside of development?