noaa weather patrick wolfram. what it does allows user to specify a zip code performs http get...
TRANSCRIPT
![Page 1: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/1.jpg)
NOAA Weather
Patrick Wolfram
![Page 2: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/2.jpg)
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
![Page 3: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/3.jpg)
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
![Page 4: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/4.jpg)
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
![Page 5: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/5.jpg)
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
![Page 6: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/6.jpg)
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
![Page 7: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/7.jpg)
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
![Page 8: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/8.jpg)
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
![Page 9: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/9.jpg)
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
![Page 10: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/10.jpg)
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
![Page 11: NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays](https://reader036.vdocuments.us/reader036/viewer/2022083006/56649f355503460f94c52e25/html5/thumbnails/11.jpg)
Questions?