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 Build a Weather App (2015) Hooking Up the Model to the View Setting the Weather Icon

decimal values still showing!

in the app, the decimals for precipitation and temperature are still showing. (except they are always 0s) thanks in advance!!

2 Answers

If you return a double it will always add the .0 at the end. You want to return an int like this:

public int getTemp() {
        return (int)Math.round(mTemp);
     }

Thanks for your help, eric! this fixed everything!

did you cast values in getters to int ?

this is my get temp method:

getTempMethod.java
  public double getTemp() {
        return (int)Math.round(mTemp);
     }

but the funny thing is: I didn't get an error when I typed the code BEFORE I added the int cast.

James, you need to set the return type of getTemp() to int instead of double.