Reputation: 21076
I'm developing an Android project which currently has 4 packages:
com.myapp.app.activities
com.myapp.app.db
com.myapp.app.ws
com.myapp.app.utils
Would I be able to create an additional package which is just
com.myapp.app
?
Eclipse isn't letting me create this package. It tells me a package with this name already exists.
If I start a new project and create a package called "com.testing.app" and then create a new package called "com.testing.app.activities" afterward, it works fine.
For Android developers:
What I'm wanting to do is extend the Application class and have it in a separate package. Suppose com.myapp.app can't be used, what's a good name for this new package?
Upvotes: 5
Views: 1165
Reputation: 1108537
Eclipse by default hides empty packages. In the package explorer view, click at the small arrow in the right top: View Menu. Choose Customize View. In the Filters tab you need to uncheck Empty packages. Now empty packages will be visible in the package explorer.
Upvotes: 3
Reputation: 93157
The package com.myapp.app
already exists. You can create a class named com.myapp.app.MyClass
, you'll see it right in the app
package.
Another thing you can do is changing the layout of your packages from a flat layout to a hierarchical layout :
Resources :
Upvotes: 3
Reputation: 21076
It would appear that if I manually place a file into the directory and refresh the package explorer in Eclipse, the new com.myapp.app package appears
Upvotes: 0
Reputation: 20875
Eclipse won't let you create this package because it already exists.
Packages in Java are represented in the filesystem as hierarchical folders: com.myapp.app.activities
is in the com/myapp/app/activities
folder. com/myapp/app
already exists, so you can't create this package.
In Eclipse, juste create a new class, and in the "Package" section, precise you want to create it in the com.myapp.app
package. This should work.
Upvotes: 12