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

How do i convert the value to celsius in Android Weather app ?

Hey how do i convert the Fahrenheit value in the temperature to degree Celsius.

1 Answer

You can have Forecast.io return SI units (Celsius is considered SI by Forecast.io) by adding a query parameter. Using their example it would look like this:

https://api.forecast.io/forecast/YourAPIKey/37.8267,-122.423?units=si

Or just convert the value you get in your code:

double celsius = (fahrenheit - 32.0) * (5.0 / 9.0);