Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
I am trying to search for drawable (pictures) in a resource file in android from my library project Is it possible without the context of the of the actual android project or do I need to add that in? Also how would I be able to find an ID through my library project by using a string as the name of the ID and then convert it to the appropriate integer to set the background resource. This is what I have tried so far: This works but only looks at the rescources in the library project, I need to look at the resources in the current application project
| |||
The actual drawable resources are compiled into your app, so accessing them is no different than accessing normal app resources. Supposing the ID of the drawable in the library is big_picture. Then R.drawable.big_picture is the ID of the drawable you want to load. You don't have to use introspection. If R.drawable.big_picture is not available, there's something wrong with your project setup (or a compile error). | |||
What's the package name of your library project. If your package name is
Then in the same file where you imported this R, you can just type | ||||
default
.
stackoverflow.comm
No comments:
Post a Comment