From the course: Android App Development: Design Patterns for Mobile Architecture

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implement coordination pattern

Implement coordination pattern - Android Tutorial

From the course: Android App Development: Design Patterns for Mobile Architecture

Start my 1-month free trial

Implement coordination pattern

- [Instructor] In looking at our activities, the SpyDetailsActivity, for example, line 64 through 74, this is all navigation logic, which really doesn't belong within an activity. So the next step is to move this type of logic into a single class, or a single layer. In our case, it'll just be a root coordinator. And this way we can decouple ourselves from the logic of what to show, when to show. This is a great thing for if you have split testing or A/B testing, this type of process makes it easier to choose different activities to show depending on each case. So the first thing we're going to do is to create another package. In this case, we're just going to call it the Coordinators. And we'll make a single class. We'll call this the RootCoordinator. And we won't have to put any logic on it yet. Let's go to our dependency registry. And we'll just make an instance of this, public RootCoordinator is equal to new_RootCoordinator. And we'll make this a whole region. Eventually in an…

Contents