Android networking in 3 steps with RoboZombie 1.3
This is a simple example which showcases networking on Android with RoboZombie.
<br>
Step 1: Create the Model
public class Repo {
private String id;
private String name;
private boolean fork;
private int forks_count;
...
}
<br>
Step 2: Define the Endpoint Interface
@Deserialize(JSON)
@Endpoint("https://api.github.com")
public interface GitHubEndpoint {
@GET("/users/{id}/repos")
List<Repo> getRepos(@PathParam("id") String id);
}
<br>
Step 3: Inject and Invoke
@Bite
private GitHubEndpoint gh;
{
Zombie.infect(this);
}
...
List<Repo> repos = gh.getRepos("sahan");
<br>
Use it with...
<dependency>
<groupId>com.lonepulse</groupId>
<artifactId>robozombie</artifactId>
<version>1.3.2</version>
</dependency>
or...
dependencies {
compile 'com.lonepulse:robozombie:1.3.2'
}
or...
<br>
Check out the full documentation at sahan.me/RoboZombie
Written by L. Sahan J.
Related protips
2 Responses
Why is it an apklib? I don't seem to find any resources it needs. Can you make it a simple jar?
over 1 year ago
·
@cristian Yes agreed, and I doubt it will ever use any resources. Pushed a jar artifact to the releases repo, should be available now with:
<dependency>
<groupId>com.lonepulse</groupId>
<artifactId>robozombie</artifactId>
<version>1.2.3</version>
<type>jar</type>
</dependency>
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#