开发者

Android development, Source file organization/notation best practices?

Android lists coding standards but does not seem to go into how source (Activity's, etc) files should be organized. As my project grows im wondering how I should be breaking up the classes or if I just just leave a mess of 20 files in the sr开发者_运维知识库c folder. It does not seem like there is any sort of notation (like Hungarian) nor an way to id whats an activity, or other helper class. Are there any docs on these sorts of best practices?


If you look at the apps that come with the android source, like gallery, launcher ect. you will notice that those guys pretty much kept everything in one folder... Quite a mess if you ask me. I usually have a folder "widget" for all my views, one for activities, one for providers one for utilities whatever.

Browsing throug open source projects alot, i dont think there is any common standart for doing this. Use what works best for you.


We already had a little discussion about it here:

Android separate packages

Besides that, I think following the (pure) Java coding standards is a good practice.


Do you really have everything in your base src folder? A good start would be to put your classes into packages. After that, you could create a "util" package for your helper classes and name them as such (ie. MainActivityUitl.java).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜