Bridge the gap between the presentation layer and the android lifecycle.

Maintaining references to objects in Android can be dangerous because the platform may destroy them and reclaim the memory at any time.
We need a solution to decouple our business logic from the details of the android framework.
The two widely adopted solutions are an Event Bus and an Injection Framework.
The bus allow us to broadcast a certain event without holding an explicit reference to the objects that will respond to this event.
Having an event bus in place means that we can cache and manipulate asynchronous responses easier than if we used AsyncTasks or Loaders.
Injection allow us to add dependencies to the object that we can't construct, like activities and fragments, makes our architecture cleaner and with less boilerplate code and makes writing tests easier.
Define a Controller to drive the activity behavior

The easiest way to TDD an activity is to write a controller for it.
You'll start to test the behavior that you want to accomplish with that component, like handling a search query or update the ActionBar information.
Notice that there are no notions of intents or instanceState or lifecycle callbacks in our controller.
That's a good way to separate how a certain behavior is accomplished from the behavior itself.
Create a search configuration and make the test pass

We can now create a searchable configuration and use the controller inside the activity to make the test pass.
All Android related boilerplate is confined inside the activity while the controller encapsulates the logic behind it.
We can remove boilerplate duplication (savedInstanceState, findViewById, Intent navigation) using annotations or injecting helpers, depending on our need.
We can start using these tools when our domain is more defined.
Add test fixtures to the real Github service

Our integration tests are green, but we are running those tests against a mock server.
In order to test that our predictions are correct and that the apis are stable, we can exercise our code against the live service.
This step can be taken in parallel with the development of the rest of the application code.
Since we are exploring another boundary, the api service, we wrap the implementation details with our own interface, the GithubApi.
We pick Retrofit as a REST framework for its ability to run both on Android and on JVM.
Rewrite Service injection using multiple levels

This small refactoring allow us to easily swap one service for another, while keeping our IT run in mock mode.