Giter Site home page Giter Site logo

rxretrofitgithubexample's Introduction

RxRetrofitExample #1

This GitHub project is an example of RxJava combined with Retrofit for my AnDevCon SF 2014 session, Be Reactive with Retrofit.

This example uses the GitHub API to read the current user's list of Gists, show them as a ListView. When an Gist URL is clicked in the ListView, a ListView is populated with the contents of the files in the Gist.

Topics to Learn

  • Returning Observables from Retrofit
  • Using Retrofit as a Service

Returning Observables from Retrofit

Since January 2014, Retrofit has allowed developers to return an RxJava Observable instead of accepting a callback for asynchronous operation or returning a Plain Old Java Object for synchronous operation.

For example, this code includes the following interface to download the list of Gists from GitHub's REST server:

public interface GitHubClient {
    @GET("/gists")
    Observable<List<Gist>> gists();
}

Using Retrofit as a Service

Using a service offers the possibility of loose coupling between activities and the network requests they initiate. This means one may initiate a network request in one activity, cause an orientation change, and then retrieve the result in the newly-created activity. For a working example, check out Stephane Nicolas' Robospice.

rxretrofitgithubexample's People

Contributors

colintheshots avatar mentormate-colinlee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.