Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to organize project resources?

I'm wondering what some good ways of organizing Android projects are. I'm building a little recipe application and have already made dozens of layouts, drawable resources, menus, etc., not to mention Java source code.

Android does not allow sub-folders for resources, so is there a way to organize them? Right now I'm trying to organize them through naming conventions (e.g. new_list_ingredient_edit) but I'm wondering if there is a better way, as the names will probably get pretty long and cumbersome.

Same thing with resources such as string values. As I understand it, I can create multiple resource files (e.g. strings_new_ingredient.xml, drawables_new_instructions.xml, etc.) but all my resources across files have still have to have unique names, which again is cumbersome.

like image 240
Tianxiang Xiong Avatar asked Aug 11 '11 06:08

Tianxiang Xiong


People also ask

How do I organize my Android projects?

Android applications should always be neatly organized with a clear folder structure that makes your code easy to read. In addition, proper naming conventions for code and classes are important to ensure your code is clean and maintainable.

What folders are important in Android project?

The resource folder is the most important folder because it contains all the non-code sources like images, XML layouts, and UI strings for our android application.

What is resource Management Android?

Resource Manager is a tool window for importing, creating, managing, and using resources in your app. You can open the tool window by selecting View > Tool Windows > Resource Manager from the menu bar or by selecting Resource Manager on the left side bar.


Video Answer


1 Answers

Although android doesn't allow sub-folders for resources, it does for assets, but this is much more cumbersome to use.

A possible option would be to use a sql database with all of your strings, but this approach is probably too much work and more cumbersome anyway.

Your naming convention method is probably your best option. You could think of some of the seperated words as directories if you want, which should keep it organized enough.

like image 122
zim333311 Avatar answered Oct 16 '22 13:10

zim333311