Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

I'm working on Android Stormy Weather App, and I wanted to use the metric units for degrees. Could you help me.

Weather App converting to celcius degrees.

2 Answers

OK! Ignoring my first answer how about if you update your forecastUrl string to read as below:

I haven't worked through the Android Lists and Adapters course yet so I don't know if anything else has changed :)

String forecastUrl = "https://api.forecast.io/forecast/" + apiKey + "/" + latitude + "," + longitude + "?units=si";

Hope it helps!

Stephen

You got it. Now we're talking. Thanks for your help.

No worries glad it helped!

Hi alainstudio

You could update your getTemperature() method in the CurrentWeather class so it looks like below:

Basically just searched on Google for a method of converting Fahrenheit to Celsius and dropped it in.

public int getTemperature() {
        return (int)Math.round((mTemperature-32) * 5 / 9);
    }

Hope it helps!

Stephen

Hi Stephen, Thanks for your help. That works for the main tempuature but not for the 7 days. I notice on the Forecast.io the units in us or si (metric). Can we change this in the code?