Download presentation
Presentation is loading. Please wait.
Published byClaud Smith Modified over 9 years ago
1
NOAA Weather Patrick Wolfram
2
What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays Pictorial Representation of weather, a description of visual conditions, temperatures in Fahrenheit and Celsius, and a radar image
3
How It Works Starts with a simple GUI consisting of an EditText used to enter zip code and a button to start HTTP GET Request Using a PHP script on the noaa.gov site, the request returns the relevant html for the zip code Once the request is finished, a new activity is started using an Intent with the html as a String for the extra
4
How It Works The TextViews in the new activity are set to specific values parsed from the html URLs for the pictorial weather representation and the radar webpage are parsed from the html These URLs are used in two different AsyncTask classes to retrieve a picture and a page, respectively
5
How It Works The image URL is used to retrieve the image data with an HTTP GET request The webpage URL is used to retrieve the page data with an HTTP GET request, which in turn is parsed and used to get the URLs of the radar images These URLs are used for further GET requests, which place the data into Bitmap objects
6
How It Works Once the main activity receives the Bitmaps and input stream data, it uses them to update the layout The input stream data is placed into a Bitmap object and displayed The Bitmaps are overlaid on one another and displayed
7
Design Each HTTP GET has its own class The first gets the webpage for the zip code in its doInBackground method and starts the new activity in its onPostExecute method The second gets the image stream in its doInBackground and uses a reference to the second activity to pass the stream back to the activity in its onPostExecute The third gets the radar page and several images in its doInBackground and uses a reference to the second activity to pass the Bitmaps back to the activity in its onPostExecute
8
Design This is the main activity of the app It includes an EditText view, which is used to get a zip code from the user There is also a Button, which is used to initiate an HTTP GET request with the entered zip code The background makes the app seem more interesting
9
Design This second activity is made up of four TextViews: The City, State view, the visibility view, the Fahrenheit view, and the Celsius view It also includes two ImageViews, one for the pictorial representation of the weather, and one for the radar image These are all set programmatically from data obtained through GETs All views are contained in a ScrollView so the whole radar image can be observed
10
Demonstration To demonstrate, I will load up the page for the site on my computer I will then run the app, which will be compared to the website to show the mapping of data from that on the site to that in the app
11
Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.