Say I have an xml file called test1.xml in the format String xmlFile = "test1.xml". How can I get the value of R.id.test1?
I think you need a method getIdentifier (String name, String defType, String defPackage)in the class Resources. Here is the documentation .
getIdentifier (String name, String defType, String defPackage)
Resources
However, this approach is rather slow; pay attention to the following documents:
Note: Using this feature is not recommended. It is much more efficient to retrieve resources by identifier than by name.
Here is another similar question: get the resource identifier by passing the name as a parameter in android
Source: https://habr.com/ru/post/1771549/More articles:Почему мы передаем ссылку, когда у нас есть выбор сделать переменную внешней? - cRegex: word boundary, but for space, only the beginning of a line or the end of a line - regexHow to prevent URL entry and redirect user to login page? - asp.netDjango: сохранение модели Model с пользовательскими моделями "многие-ко-многим" - pythonDeploying Java Web Start at Windows startup - javaWPF DataGrid Gets cell value during user input - c #A memory-based memory card in Python (or C) - pythonhow to improve text accuracy in mysql? - mysqlMy Silverlight application shows no changes - silverlightSimple shared library - c ++All Articles