Android - does the R.Resource identifier change at runtime

I have a number drawablesto choose from View. When the user selects one of drawable, and the next time the application starts, I should show only the selected option.

Is it good to keep Resource IDin general preferences and retrieve the selected option with the Resource IDnext time you start the application.

+4
source share
1 answer

All ids-related ids classes are generated at compile time, so they will not change at runtime. There is nothing stopping you from storing these identifiers in SharedPreferences, however there is no benefit. This is almost always faster, just to reference the identifier R.drawable.x.

+9
source

Source: https://habr.com/ru/post/1536891/


All Articles