My application depends on a library project.
The menu.xml file is within the application project.
All the java code is within the library projec
I found @triad's solution with Resources.getIdentifier(String, String, String) to be somewhat error-prone:
String arguments to a single method are easy to use incorrectly.I found this approach to work better for me:
String libString = context.getString(example.library.pkg.R.string.library_string)
Where the library's package is example.library.pkg.
R class is resolved at compile-time, so your IDE will tell you if you referenced it correctlyimporting the library's R class allows you to still use your own local R later,
and explicitly marking the external resource usages makes them easier to spot.