Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build an Interactive Story App (Retired) Finishing the User Interface Wrapping Up

Fahmi Eshaq
Fahmi Eshaq
3,002 Points

Why Did the instructor Put StoryActivity and MainActivity under ui? Aren't activities Controllers and layout is UI?

Why Did the instructor Put StoryActivity and MainActivity under ui? Aren't acitvities Controllers and layout is the UI?

Sample screenshot http://imgur.com/wgfsu0X

1 Answer

Seth Kroger
Seth Kroger
56,407 Points

This is under Java code and and the UI code in Java is almost always a controller, while the layout is in XML under the res/ directory with it's own strict directory rules. StoryActivity and MainActivity are UI controllers, so it does make some sense to put them under ui/ to distinguish them from other controllers, such as datasource or api controllers. There are no strict rules for naming Java subdirectories/packages so the names are at your discretion, and if you have a naming scheme that makes sense to you, you can use it.