views:

50

answers:

2

I called my main activity Main, and Eclipse created Main.java and res/layout/main.xml for the layout.

Is there any reason why Eclipse dropped the uppercase "M" for the layout file?

Was I wrong to use upper case M for the name of my Main class (a Java convention, types start with uppercase, objects with lower case)?

+2  A: 

Layout file names can only contain lower case letters, numbers, underscores, or periods. I'm not sure why the restriction exists, though.

Erich Douglass
Because the files may be on either a case-sensitive or case-insensitive file system, so trying to go between the two (or just generally use a case-insensitive fs with case-sensitive Java and resource names) can lead to much unhappiness.
hackbod
If the reason is inadequate filesystems, class names should be similarly restricted. (A class name, including letter case, is used as a filename by the JRE classloader). I am guessing that was not done because it would impose a change to Java itself - a big no-no for a company that already threw out the JVM.Is there any justification for anyone using a case insensitive filesystem on an Android device?
Peter vdL
Windows is case-insensitive. And the issue is much less significant in Java where you also have inside the file the class name providing the formal case (and when looking up the file from another class referring to it you will of course succeed on either fs).
hackbod
Oh and of course the standard Mac filesystem is case-insensitive as well. In fact this causes trouble for people developing the platform, since the platform source does need a case sensitive fs so you need to make a separate fs for it.
hackbod
+2  A: 

Whereas Erich is correct about the restriction to only lowercase letters in resources, it is only coincidence that you named your Activity Main. No matter what you call your primary Activity the generated layout file is always called main.xml.

CaseyB