Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting started with Udoo

You're reading from  Getting started with Udoo

Product type Book
Published in Feb 2015
Publisher
ISBN-13 9781784391942
Pages 206 pages
Edition 1st Edition
Languages

Collecting weather forecast data


Now that our application's user interface is completed, we can proceed to implement the logic to store the user's location while fetching weather data from the RESTful web service. This implementation could be organized in the following steps:

  1. Update the Preset class to store the user's location.

  2. Handle voice recognition results when the user clicks on the weather_status TextView parameter.

  3. Add a new scheduled thread that fetches weather data and updates the user interface using the onWeatherChanged() callback.

We start updating the Preset class and realizing it with the following steps:

  1. Add, at the top of the class, the highlighted declaration used as a key to store and retrieve the location set by users:

    private static final String CURRENT_PRESET = "__CURRENT__";
    private static final String CURRENT_LOCATION = "__LOCATION__";
    
  2. At the bottom of the class, add the following setter to store the given location:

    public static void setLocation(Context ctx, String name...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}