7 WeatherViewer App

Objectives

In this chapter you’ll:

  • Use the free OpenWeatherMap.org REST web services to get a 16-day weather forecast for a city specified by the user.

  • Use an AsyncTask and an HttpUrlConnection to invoke a REST web service or to download an image in a separate thread and deliver results to the GUI thread.

  • Process a JSON response using package org.json classes JSONObjects and JSONArrays.

  • Define an ArrayAdapter that specifies the data to display in a ListView.

  • Use the ViewHolder pattern to reuse views that scroll off the screen in a ListView, rather than creating new views.

  • Use the material design components TextInputLayout, Snackbar and FloatingActionButton from the Android Design Support Library.

Get Android How to Program, 3/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.