p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Professional Android 2 Application Development (http://p2p.wrox.com/book-professional-android-2-application-development-547/)
-   -   Newbie (very newbie!) question about com.paad.* (http://p2p.wrox.com/book-professional-android-2-application-development/82645-newbie-very-newbie-question-about-com-paad.html)

jkcashin February 17th, 2011 02:39 PM

Newbie (very newbie!) question about com.paad.*
 
I am new to Java and very very new to Android development. I see references to com.paad.* everywhere in this book. What does this mean? Is this just a namespace? If I have my own domain name say JamiesDomain.com, should I be using com.JamiesDomain.* ??

Apologies for the noob-ness of these questions, but it's been driving me nuts, and I have not found an answer through searching.

Jamie

bialesch May 23rd, 2013 05:23 PM

Newbie here too. Curious about the same!

GreddyDC5 June 5th, 2013 06:46 AM

Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. For this reason, it's generally best if you use a name that begins with the reverse domain name of your organization or publisher entity. For this project, you can use something like "com.example.myfirstapp." However, you cannot publish your app on Google Play using the "com.example" namespace.


Reference: http://developer.android.com/trainin...g-project.html

I believe you can name it however you want, but if your company has a website JamiesDomain.com I think, as per this paragraph, that you can name it com.JamiesDomain.yourappname

GreddyDC5 June 5th, 2013 06:52 AM

More info
 
I hope this also helps!

Naming a Package

With programmers worldwide writing classes and interfaces using the Java programming language, it is likely that many programmers will use the same name for different types. In fact, the previous example does just that: It defines a Rectangle class when there is already a Rectangle class in the java.awt package. Still, the compiler allows both classes to have the same name if they are in different packages. The fully qualified name of each Rectangle class includes the package name. That is, the fully qualified name of the Rectangle class in the graphics package is graphics.Rectangle, and the fully qualified name of the Rectangle class in the java.awt package is java.awt.Rectangle.

This works well unless two independent programmers use the same name for their packages. What prevents this problem? Convention.
Naming Conventions

Package names are written in all lower case to avoid conflict with the names of classes or interfaces.

Companies use their reversed Internet domain name to begin their package names—for example, com.example.mypackage for a package named mypackage created by a programmer at example.com.

Name collisions that occur within a single company need to be handled by convention within that company, perhaps by including the region or the project name after the company name (for example, com.example.region.mypackage).

Packages in the Java language itself begin with java. or javax.

In some cases, the internet domain name may not be a valid package name. This can occur if the domain name contains a hyphen or other special character, if the package name begins with a digit or other character that is illegal to use as the beginning of a Java name, or if the package name contains a reserved Java keyword, such as "int". In this event, the suggested convention is to add an underscore.

For example:
Legalizing Package Names Domain Name Package Name Prefix
hyphenated-name.example.org --> org.example.hyphenated_name
example.int --> int_.example
123name.example.com --> com.example._123name


Reference: http://docs.oracle.com/javase/tutori...amingpkgs.html


All times are GMT -4. The time now is 10:58 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.