Results 1 to 15 of 15
Like Tree2Likes
  • 1 Post By kjkrum
  • 1 Post By Tolls

Thread: Packages in our app

  1. #1
    Nazneen Ali is offline Senior Member
    Join Date
    Jul 2011
    Posts
    112
    Rep Power
    0

    Default Packages in our app

    When we create a new activity in android using the eclipse IDE, we are require to enter the application name, project name and package name. When we are entering the package name, a tip (a kind of label at the bottom of that form) is visible, which says that the package name should remain the same for the life time of the application, because this is how different versions of the app are considered the same app.


    1. Is this statement about the package containing the main activity, or should the names of all the packages in our application remain the same for the life time of the application?
    2. and is it a good practice to organize our source code of a single app into multiple packages?


    Thank you in advance.
    Don't forget to smile :-)

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Packages in our app

    1. The Android package name is unrelated to Java package names. They're often the same only because they follow similar conventions. You can change Java package names all you want without changing the identity of your app.
    2. Usually.
    Nazneen Ali likes this.
    Get in the habit of using standard Java naming conventions!

  3. #3
    Nazneen Ali is offline Senior Member
    Join Date
    Jul 2011
    Posts
    112
    Rep Power
    0

    Default Re: Packages in our app

    Packages in our app-eclipse.png


    Please can you tell me which package are they talking about in the statement shown in the screenshot?
    Don't forget to smile :-)

  4. #4
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Packages in our app

    The third blank in the dialog.
    Get in the habit of using standard Java naming conventions!

  5. #5
    Nazneen Ali is offline Senior Member
    Join Date
    Jul 2011
    Posts
    112
    Rep Power
    0

    Default Re: Packages in our app

    The third blank in the dialog.
    No, I am not that dumb =)

    What I meant to ask was that they are saying different versions of our app will be identified as the same app by keeping the package name unchanged for the life time of the app.

    Now suppose our app has multiple packages.

    One of those packages will contain the launcher activity. Do they mean to say that the name of that very package must always remain the same?

    Or do they mean to say that the names of all the packages have to remain the same forever?
    Don't forget to smile :-)

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,945
    Rep Power
    19

    Default Re: Packages in our app

    No, just the main package name.
    The package name you put in the third box.

    That's how Android identifies it as the same package.

    So if you have a new application, and the package entered in the third box is com.example.mynewapp, then that name cannot change if you want Android to be able to identify them as the same app for updates etc.
    Nazneen Ali likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    Nazneen Ali is offline Senior Member
    Join Date
    Jul 2011
    Posts
    112
    Rep Power
    0

    Default Re: Packages in our app

    Thank you very much @Tolls
    Don't forget to smile :-)

  8. #8
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Packages in our app

    Like I said in my first comment...
    Get in the habit of using standard Java naming conventions!

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,945
    Rep Power
    19

    Default Re: Packages in our app

    I know.
    Don't ask me why they didn't grasp that...
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,870
    Rep Power
    5

    Default Re: Packages in our app

    Quote Originally Posted by Tolls View Post
    Don't ask me why they didn't grasp that...
    Oh I can hazard a guess that it has something to do with wanting to build a castle without learning how to use the equipment to do it.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  11. #11
    Nazneen Ali is offline Senior Member
    Join Date
    Jul 2011
    Posts
    112
    Rep Power
    0

    Default Re: Packages in our app

    it has something to do with wanting to build a castle without learning how to use the equipment to do it.
    Asking a question means trying/wanting/attempting to learn.
    Don't forget to smile :-)

  12. #12
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,870
    Rep Power
    5

    Default Re: Packages in our app

    That is a good start, sure. But it is not as simple as that, it never is. You also have to do your very best to understand and respond to the answers you get. And that you really did not do.

    And then there is the following to consider: SHOULD you have asked these questions, or should you have been reading a manual? I'll leave that up to you to consider and decide, but I must stress that if you go for the easy option, you are going to get stuck with everything you do. Future employers are not going to keep paying you salary if you can't even research information yourself.

    That's my two cents, do with it what you want. Including assuming I'm an ahole and should shut up, I don't care.
    Last edited by gimbal2; 11-07-2013 at 10:37 AM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  13. #13
    Nazneen Ali is offline Senior Member
    Join Date
    Jul 2011
    Posts
    112
    Rep Power
    0

    Default Re: Packages in our app

    I did try to search and find it out (although yes i did not read the manual particularly) before posting the question, and i could not properly understand the first answer I got, so assuming that i failed to make my question properly understood, I posted a screen shot, then asked the question again and got the answer which made me clear about it.

    Anyways I'll take your advise, and try to improve my search skills rather. I know I am not supposed to drag this discussion further, but still since I feel I have been kinda mocked (no offence to anyone, I respect and am grateful that you people answer my questions but ridiculing is a bit rude) I want to say that I do try to find it out before asking. Thank you everyone for answering the question.
    Don't forget to smile :-)

  14. #14
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,870
    Rep Power
    5

    Default Re: Packages in our app

    Good answer! No rudeness or mocking of any kind. It is at its best, tough love. It is a need for me to try and persuade people to have the right frame of mind (which is to not try and take the easy way out but put in the work) after having seen so many people go down the wrong path and end up getting burned; to be honest I have been down it myself until someone yanked me out and put me straight.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  15. #15
    Nazneen Ali is offline Senior Member
    Join Date
    Jul 2011
    Posts
    112
    Rep Power
    0

    Default Re: Packages in our app

    Thank you for your advise. I'll work on it. Thanks again.
    Don't forget to smile :-)

Similar Threads

  1. com.sun packages
    By Aileen in forum JavaFX
    Replies: 1
    Last Post: 03-13-2012, 09:58 PM
  2. help with packages
    By JLSHARP92 in forum NetBeans
    Replies: 1
    Last Post: 01-26-2012, 02:55 PM
  3. Packages
    By urbim in forum Eclipse
    Replies: 2
    Last Post: 07-02-2009, 02:01 PM
  4. packages
    By fogus in forum New To Java
    Replies: 1
    Last Post: 03-24-2009, 06:14 AM
  5. Replies: 3
    Last Post: 02-12-2008, 11:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •