开发者

What's the difference between android and com.android?

What's the difference between android and com.android?

For instance, the file android/nfc/ErrorCodes.java has a different content than com.android/nfc/ErrorCodes.java - both file exist in the Android's source code.

I want to know why there is a package called android, and also one called com.android. Why com.android was not enough so they also made android, with no dots? I want to understa开发者_JAVA百科nd why the content of the files with the same name is different.


Well the difference is just that of packaging, according to the industry standards the organizations have their applications with the package name in the reverse order of their declared urls(general practice , not mandatory ). For example a company with url www.example.company.com will have the packages for their application in the form com.company.example. One more point is that when you are using IDE like eclipse or NetBeans the IDE will create this directory structure for you, going with the example it will create a directory com and company inside it and inside company you will have example directory , this whole thing is your package and then the source/java files will be kept at this level.


I want to know why there is a package called android, and also one called com.android.

Someone messed up along the lines and they decided to fix it and rename it accordingly.


com.android is for internal usage whereas android package is part of public SDK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜