Answer the question
In order to leave comments, you need to log in
Where in code are strings from strings.xml stored in Android studio?
In general, such a question arose and I do not know how to google it correctly. In Android studio, you can refer to some string from strings.xml, as if this variable is in some class, although in reality they are only registered in the xml file at this point in time. Do I understand correctly that when building a project, these lines are auto-generated somewhere and then the programmer can already access these lines?
Answer the question
In order to leave comments, you need to log in
The lines are in xml (maybe packed in binary form) in the application's resources. An R-file is also generated (the IDE generates it, and it is also generated during the build), it contains the line IDs, not the lines themselves. In runtime, lines from resources are read by IDs from the R-file, there is a special Resources class, it uses AssetManager. When you do
context.getString(R.string.mystring) or context.getResources().getString(R.string.mystring) this is what happens.
If you want to know more - open the code and read it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question