Cole
Cole

Reputation: 2815

Can't reference drawable PNG in Java?

I have about 10 pictures in my drawable folder. But when referencing some of them in Java like this:

R.drawable.example

Only about 6 of the pictures show up when pressing CTRL+Space. If I try to reference some of the pictures, they don't show up in the CTRL+Space dialog box. If I try to type the filename manually, I get an error in my Java, as if they don't exist in my drawable folder.

Upvotes: 3

Views: 5935

Answers (4)

Aniruddha K.M
Aniruddha K.M

Reputation: 7521

Faced the same issue what worked for me was doing the below

File -> Invalidate Cache/Restart

Upvotes: -1

Bill Gary
Bill Gary

Reputation: 3005

Are there any uppercase letters in the image names? If so, switch them to lowercase, you can't use uppercase in image names.

Upvotes: 2

edthethird
edthethird

Reputation: 6263

check your imports at the top of the file. Without samples, this is a guess, but PROBABLY there is:

import Android.R

but it should say:

import myProject.R

Upvotes: 11

Sam Dozor
Sam Dozor

Reputation: 40754

Have you tried right-clicking on your res folder within the Eclipse Package Explorer, selecting refresh, and then going to Project -> Clean, and then rebuilding your project?

Upvotes: 5

Related Questions