Solution based on making Android project into jar package and resource file

It should be noted that if it is provided to third-party developers in the form of jar package and resource package, resources can not be referenced in the code of our project in such a way as r.layout.main, r.string.name, etc.

Therefore, we can't use the R file directly. Instead, we need to dynamically obtain the resource ID through the field name and use it again.

The following encapsulates a class that can dynamically obtain the ID through the field name.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>