Android: R.drawable not showing my image?
In my android 2.2 app, I’ve added my image to the res/drawable-mdpi folder. However, I cannot seem to access it using R.drawable.. As far as I know, there isn’t any additional configuration I need to do – any help?
5 Solutions collect form web for “Android: R.drawable not showing my image?”
I figured this out. The issue was that the project was importing android.R instead of using the generated R file – if you encounter this problem, check your imports to make sure the correct package/file is being imported.
Have Faced the same sort of error, instead of importing contents (pictures) properly, I copied to drawable-hdpi folder, which in turn wasn’t generating R Constant ID, you have to import it, rather than just dropping it there.
I had the same problem for a different reason. In my case I had illegal characters in the image file name and hadn’t noticed the console message complaining about it.
Once I’d renamed icon-1.png to icon_1.png all was well.
You need to use a fully qualified name when importing the generated R file. Check your import statements.
Take the following package statement:
Then the generated R file can be imported using:
If you would like to import a file, for example an image file then you need to go to the res/drawable-XXXX and right click on the folder and then select “import” and in the setup select general files and go to the folder where the images are and select the files that you want to import… Netbeans does this automatically but the eclipse lack this feature