Reputation: 457
What is the algorithm to generate R. Will the param in R be always the same?
SharedPreferences preference = getPreference();
Object object = preference.getString(R.id.xxx);
I want to know that the value of R.id.xxx will change or not.
-----------------------try to ask the question more clearly-----------------
v1 = R.id.listview;
then clean the project;
v2 = R.id.listview;
will v1 = v2 all the time?
I tested like this. Print the R.id.xxx,clean project and print the R.id.xxx again. The result is the same.
But I don't know in different IDE, that value of R.id.xxx will change(the AAPT version is all the same or not).
Upvotes: 0
Views: 609
Reputation: 457
I found the answer.But unluckily, it's not in english. Now I'll try to answer the question myself.If there's errors,please tell me.
There is a file in res/values/public.xml in the sdk directory.
The value will always read public.xml first.
So now you know if you didn't delete the file, the value will always the same.
But you delete it,I don't know what will happen.I'm afraid my application will have some error, so I didn't do the experiment.
If anyone has a link of article about how android generate R in English,comment or create a new answer thanks.
Upvotes: 1
Reputation: 4335
Android R.java is an auto-generated file by aapt (Android Asset Packaging Tool) that contains resource IDs for all the resources of res/ directory.
Note: If you delete R.jar file, android creates it automatically.
Edit:
for more details about R.java , kindly refer here
Upvotes: 1