Effortless Android Networking

robozombie   /rō-bō'zŏm'bē/   noun.

1. Accepts an annotated interface which describes a remote service to give you a proxy implementation of it.   2. Invoke the methods on the proxy to make network calls.


  Fork me on GitHub        robozombie-1.3.2.jar

1. Create a model.

public class Repo {

    private String id;
    private String name;
    private boolean fork;
    private int forks_count;

    ...
}

2. Define the endpoint.

@Deserialize(JSON)
@Endpoint("https://api.github.com")
public interface GitHubEndpoint {

    @GET("/users/{id}/repos")
    List<Repo> getRepos(@PathParam("id") String id);
}

3. Inject and invoke.

@Bite
private GitHubEndpoint gh;   
{
    Zombie.infect(this);
}

...

List<Repo> repos = gh.getRepos("sahan");