0

I have an app on the iPhone and need to port it to android. For this I would like to group screen related files like classes and xml per screen in one "screen group" per screen somehow, ideally also strings and other value files

if I use folders I can only group res files separately and src files separately.

what would be the best way?

Thanks very much!

EDIT:

If that should not be possible, how to best then solve this issue? Do you create a subfolder in the src and another in the res for each screen?

3 Answers 3

1

The way you group files for the iphone is not possible for an android project. Android has pre determined folders which hold specific files, if you break this structure, your building process will fail. Its not ideal but that just how it it.

When it comes to source java files, they follow the concept of packages which are basically folders. The 'src' folder is the part where you can create sub folders as you desire. If you are adamant about keeping the files related to a screen in one place, you should create the layouts with java code and not use layout xml files.

But using xml layout files make development much easier and faster. Consider that as the presentation and java files as the logic+data. So group java files as you want and leave xml files in the layout folder with easy to identify names.

Sign up to request clarification or add additional context in comments.

Comments

1

android uses certain directory layout for project structures (i.e. convention over configuration). Basically you will want to put your XML layout files in res/layout directory. Please read http://developer.android.com/guide/developing/projects/index.html#ApplicationProjects for further information.

1 Comment

I know, that's exactly my issue here. How then best to organize a project so that the screen elements are "somehow" grouped. do you then make a subfolder in the res and another in the src or is there a better conventional android way of doing this?
1

Unfortunately, there's no easy way to do this in Eclipse. You can't create custom directories in your Android app's /res directory, you can only use permitted dir-names. E.g. you can't have a /res/layout-myscreen1 and /res/layout-myscreen2. You also must put your resources in /res, and your code files in packages, so they're at separate places in your project.

You can use Working Sets to group related files together however, but they're quite painful to use IMHO. Check the eclipse docs and tutorials out on them.

3 Comments

thanks for your answer - this is rather disappointing - HOW DOES ONE ORGANIZE LARGE(ER) ANDROID PROJECTS THEN in this case? ALso I tried working sets - but I use them to organize on top level only.
Yes, it's ridiculous. I'm working on a large droid project, and navigating around / finding stuff is quite annoying.
I just realized, at least one can create sub-folder/packages in the src folder and group code - although I did not find anything (except if naming) to do the other part.. Amazing for such an ADVANVED Android/Eclipse world...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.