Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't file names in the drawable folder contain special characters or start with a capital letter?

Is there a point to these rules?

like image 246
vnshetty Avatar asked Jul 20 '11 07:07

vnshetty


People also ask

Do capital letters matter in file names?

It is a very good idea to use all lower-case letters for all file names. There are two main reasons for this. (1) If you use your files on the internet, you'll find that case-sensitivity matters. Whereas Windows will ignore the case, internet servers don't.

Should file names be Capitalised?

Guidelines for namesMake file and directory names lowercase. Use hyphens, not underscores, to separate words—for example, query-data. html . Use only standard ASCII alphanumeric characters in file and directory names.

What does the drawable folder contains?

A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon . There are several different types of drawables: Bitmap File.

What characters are allowed in a file name?

Supported characters for a file name are letters, numbers, spaces, and ( ) _ - , .


1 Answers

Each file inside folder is translated into java field name inside R.java class:

drawable\icon.png -> R.drawable.icon

Hence the reason for not using special characters inside file names, as they can no be used in Java names.

As for capital letters, I guess that's to avoid one little problem in Windows vs. Linux environment. That's because Linux thinks that Icon.png and icon.png are different files, and Windows thinks that Icon.png and icon.png is the same file. So anyone using Linux can create application that is not compilable on Windows.

like image 200
inazaruk Avatar answered Oct 02 '22 18:10

inazaruk