• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps OpenWeather Daily Forecase android

I am using the openweather api to receive weather information, at the moment I managed to get the current weather information by using the geo coordinates such as :

Town Name,Current Date,Current Weather,Current Humidity,Current Temp

Would anyone know how I will be able to get the forecast of the current day, night temp and auto refresh?

example:

later on today it will be rainy or sunny or snowy etc

night temp will be 18 degrees

the data will refresh every 30m

I have been trying to figure this out for days now

do you have any ideas? i'll be glad to hear them :)

any responses will be greatly appreciated :)

Code:
TextView cityField, detailsField, currentTemperatureField, humidity_field, pressure_field, weatherIcon, updatedField;

Typeface weatherFont;

   protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.weather);

weatherFont = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/weathericons-regular-webfont.ttf");

    cityField = (TextView)findViewById(R.id.city_field);
    updatedField = (TextView)findViewById(R.id.updated_field);
    detailsField = (TextView)findViewById(R.id.details_field);
    currentTemperatureField = (TextView)findViewById(R.id.current_temperature_field);
    humidity_field = (TextView)findViewById(R.id.humidity_field);
    weatherIcon = (TextView)findViewById(R.id.weather_icon);
    weatherIcon.setTypeface(weatherFont);


    Function.placeIdTask asyncTask =new Function.placeIdTask(new Function.AsyncResponse() {
        public void processFinish(String weather_city, String weather_description, String weather_temperature, String weather_humidity, String weather_pressure, String weather_updatedOn, String weather_iconText, String sun_rise) {

            cityField.setText(weather_city);
            updatedField.setText(weather_updatedOn);
            detailsField.setText(weather_description);
            currentTemperatureField.setText(weather_temperature);
            humidity_field.setText("Humidity: "+weather_humidity);
            weatherIcon.setText(Html.fromHtml(weather_iconText));

        }
    });
    asyncTask.execute("35.9495", "14.4084"); //  asyncTask.execute("Latitude", "Longitude")

    openWeatherDialog.OpenWeather(context);


}
 

Attachments

  • Screen Shot 2016-11-03 at 01.50.44.png
    Screen Shot 2016-11-03 at 01.50.44.png
    16.6 KB · Views: 107
wow, i just opened the link using my api key and there is tons of text inside it
what am i meant to do with this o_O it's a giant text file

this a couple of lines from it
{"city":{"id":524901,"name":"Moscow","coord":{"lon":37.615555,"lat":55.75222},"country":"RU","population":0,"sys":{"population":0}},"cod":"200","message":0.0029,"cnt":40,"list":[{"dt":1478196000,"main":{"temp":273.62,"temp_min":273.125,"temp_max":273.62,"pressure":996.97,"sea_level":1017.4,"grnd_level":996.97,"humidity":97,"temp_kf":0.5},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":92},"wind":{"speed":3.58,"deg":156.001},"snow":{"3h":0.285},"sys":{"pod":"n"},"dt_txt":"2016-11-03 18:00:00"},{"dt":1478206800,"main"

just saw the link of www.survivingwithandroid.com, what is json exactly? and how do i get data with it ?
:)sorry for all this hassle:(
 
Last edited:
Back
Top Bottom