1. Download our Official Android App: Forums for Android!

Apps Developing a weather forecast application

Discussion in 'Android Development' started by holdborn, May 13, 2010.

  1. holdborn

    holdborn Lurker
    Thread Starter
    May 13, 2010

    May 13, 2010
    Hi all,

    I'm developing a weather forecast application and I'm in need of some help here.

    At first, the application uses radio buttons to either get the location of the user through GPS or enter a location manually. Once the user decides what they will do, I used the code below to progress:

    Code (Text):
    1.     public void onClick(View v) {
    2.         if (v == getReport)
    3.         {
    4.             if(getLocation.isChecked() == true)
    5.             {
    6.                 handleReverseGeocodeClick();
    7.             }
    8.             if(specifyLocation.isChecked() == true)
    9.             {
    10.                 locationString = ((EditText) findViewById(R.id.locationInput)).getText().toString();
    11.                 parseWeather(locationString);
    12.             }
    13.         }

    handleReverseGeocodeClick(); calls up Google's reverse geocoding and translates the coordinates to a location, and the other code converts the location to a string and calls the parseWeather() method to operate on a parser to parse the report from the goolge api.

    I then implemented the parser and created another class, WeatherReport which basically stores information about the weather.

    As the parser goes through the report, I used the following code to store the details in WeatherReport:

    Code (Text):
    1.                 int temp = Integer.parseInt(dataAttribute);
    2.                 this.weatherReport.setTomorrowsMaxTemp(temp);
    I've created the layout of the weather report in another view, called report and I want to load this layout once the parsing is complete. I don't really know how to do that so any help would be appreciated.

    Thank you


Share This Page