Lesson Weekend

Our main package is starting to look a little messy. We have Java classes for our Restaurant model mixed up with Java classes for our user interface. Let’s create a few sub-packages to organize our project better.

To create a new sub-package, right click on the main package name and select New > Package:


We will create the following three subpackages to better organize our project:

  • models, containing our Restaurant model and any future models.
  • ui , containing all of our activities.
  • services, containing our YelpService class.

Drag and drop each Java class into their corresponding packages and select Refactor from the dialog that appears:


Once complete, our file tree in Android Studio should look like this:


Example GitHub Repo for MyRestaurants

Lesson 9 of 21
Last updated more than 3 months ago.