Android的 - 包名称约定名称、Android

由网友(哼著情歌享受寂寞)分享简介:有关在android.com,包的名称是包com.example.helloandroid;?,我想问的是有没有指引/标准来命名这个包,任何人都可以给我参考For the "Hello World" example in android.com, the package name is "package com.ex...

有关在android.com,包的名称是包com.example.helloandroid;?,我想问的是有没有指引/标准来命名这个包,任何人都可以给我参考

For the "Hello World" example in android.com, the package name is "package com.example.helloandroid;", I want to ask is there any guideline/standard to name this package, could anyone give me reference?

感谢

推荐答案

Android的遵循正常的Java包约定加上这里是文本的一个重要片段阅读(关于在开发Android上广泛使用的XML文件,这一点很重要)。

Android follows normal java package conventions plus here is an important snippet of text to read (this is important regarding the wide use of xml files while developing on android).

的原因具有它以相反的顺序是做与存储介质上的布局。如果您考虑每一个周期('。')中的应用程序名称作为路径分隔符,从发布的所有应用程序将坐在一起的路径层次结构。 所以,举例来说,从Adobe包将是以下形式:的

The reason for having it in reverse order is to do with the layout on the storage media. If you consider each period ('.') in the application name as a path separator, all applications from a publisher would sit together in the path hierarchy. So, for instance, packages from Adobe would be of the form:

com.adobe.reader(Adobe Reader的)

com.adobe.photoshop(Adobe公司的Photoshop)

com.adobe.ideas(的Adobe创意)

[注意,这仅仅是一个例子并且这些可能不是确切包名。]

[Note that this is just an illustration and these may not be the exact package names.]

这些可以从内部被映射(分别)为:

These could internally be mapped (respectively) to:

COM /土坯/阅读器

COM /土坯/ Photoshop中

COM /土坯/想法

这个概念来自于Java的包命名规则,更多的可以读取 位置:*

The concept comes from Package Naming Conventions in Java, more about which can be read here:*

http://en.wikipedia.org/wiki/Java_package#Package_naming_conventions

来源:http://www.quora.com/Why-do-a-majority-of-Android-package-names-begin-with-com

阅读全文

相关推荐

最新文章