Duqe
Duqe

Reputation: 339

Android: drawable resource with numbers. Is it possible?

I would like to know if i can, somehow, create a drawable resource (png for example) called 787.png. Because Eclipse wont let me compile the project unless i modify it.

Thanks in advance.

Upvotes: 6

Views: 5217

Answers (3)

Learn2Code
Learn2Code

Reputation: 2280

So you can NOT have a drawable that starts with a number , ex: 49ers BUT you can have this _49ers which is expectable.

Upvotes: 0

Amit Gupta
Amit Gupta

Reputation: 1

Short Answer is NO, Drawable resource image name must be start character
Like as R.drawable.abc. // right R.drawable.123 //wrong

Upvotes: 0

james
james

Reputation: 26271

The reason you can't have a resource with a numeric name is because variable names cannot start with numbers. For each resource, there is a generated constant variable (in R.java) with the resource's name. If you look in your Eclipse project, under the "gen" folder you will see R.java

It is my understanding that it is not possible to have a resource with a pure numeric name in an android project.

If you explain why you require a numeric resource, maybe we can provide alternative solutions

Upvotes: 14

Related Questions