Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,413 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.