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

William Juste
William Juste
7,822 Points

Method that Ben mentions.

Around the 1:15 sec mark of the video. Ben mentioned something about a double.toString method for setting the text for the temperatureLabel. Does anyone know how to use that, rather than then ( + "") way he gets it to a String value?

3 Answers

Sai Sushanth Durvasula
Sai Sushanth Durvasula
2,759 Points

try String.valueOf(num) where num is of double datatype. Hope this helps!

William Juste
William Juste
7,822 Points

I did-

private void updateDisplay() {

    String tempString = String.valueOf(mCurrentWeather.getTemperature()) ;

    mTemperatureLabel.setText(tempString);
}

and it seems to be working- Thanks!

William Juste
William Juste
7,822 Points

No idea why my comments come out looking like that, btw

Below each comment and answer box is a link to the markdown cheatsheet. That better explains how to get code windows to show in your comments, like you accidentally did here.

William Juste
William Juste
7,822 Points

OHH I SEE

String firstName= "Nicolas";
console.printf("Thanks for your help, %s!", firstName);