Git Product home page Git Product logo

android-rottentomatoes-demo's Introduction

RottenTomatoes BoxOffice Demo

This is an Android demo application for displaying the latest box office movies using the RottenTomatoes API. See the RottenTomatoes Networking Tutorial on our cliffnotes for a step-by-step tutorial.

Screen Demo

ย 

Screen Demo

Installation

Quick note is that you must provide your own API key for RottenTomatoes in order to use this demo. To get an API key, you need to register for an account (or sign in). Once you have the key, put the key into the API_KEY constant in the src/com/codepath/example/rottentomatoes/RottenTomatoesClient.java file:

public class RottenTomatoesClient {
  private final String API_KEY = "ENTER-KEY-HERE";
  // ...
}

Once you've setup the key and imported the project into Eclipse, you should be all set.

Overview

The app does the following:

  1. Fetch the box office movies from the Box Office Movie API in JSON format
  2. Deserialize the JSON data for each of the movies into BoxOfficeMovie objects
  3. Build an array of BoxOfficeMovie objects and create an ArrayAdapter for those movies
  4. Define getView to define how to inflate a layout for each movie row and display each movie's data.
  5. Attach the adapter for the movies to a ListView to display the data on screen

To achieve this, there are four different components in this app:

  1. RottenTomatoesClient - Responsible for executing the API requests and retrieving the JSON
  2. BoxOfficeMovie - Model object responsible for encapsulating the attributes for each individual movie
  3. BoxOfficeMoviesAdapter - Responsible for mapping each BoxOfficeMovie to a particular view layout
  4. BoxOfficeActivity - Responsible for fetching and deserializing the data and configuring the adapter

The app leverages the Box Office Movies API which returns the following JSON response:

{
  "movies": [{
    "id": "770687943",
    "title": "Harry Potter and the Deathly Hallows - Part 2",
    "year": 2011,
    "mpaa_rating": "PG-13",
    "runtime": 130,
    "critics_consensus": "Thrilling, powerfully acted, and visually dazzling...",
    "release_dates": {"theater": "2011-07-15"},
    "ratings": {
      "critics_rating": "Certified Fresh",
      "critics_score": 97,
      "audience_rating": "Upright",
      "audience_score": 93
    },
    "synopsis": "Harry Potter and the Deathly Hallows, is the final adventure...",
    "posters": {
      "thumbnail": "http://content8.flixster.com/movie/11/15/86/11158674_mob.jpg",
      "profile": "http://content8.flixster.com/movie/11/15/86/11158674_pro.jpg",
      "detailed": "http://content8.flixster.com/movie/11/15/86/11158674_det.jpg",
      "original": "http://content8.flixster.com/movie/11/15/86/11158674_ori.jpg"
    },
    "abridged_cast": [
      {
        "name": "Daniel Radcliffe",
        "characters": ["Harry Potter"]
      },
      {
        "name": "Rupert Grint",
        "characters": [
          "Ron Weasley",
          "Ron Wesley"
        ]
      }
    ]
  }, 
  {
     "id": "770687943",
     ...
  }]
}

See the RottenTomatoes Networking Tutorial on our cliffnotes for a step-by-step tutorial.

Libraries

This app leverages two third-party libraries:

android-rottentomatoes-demo's People

Contributors

nesquena avatar lubaochuan avatar arriolac avatar

Watchers

Pietro Schirano 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.