Skip to content Skip to sidebar Skip to footer

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?

Solution 1:

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.

Solution 2:

You can see some discussion about this, Here

Post a Comment for "Why Can't File Names In The Drawable Folder Contain Special Characters Or Start With A Capital Letter?"