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

Lucas Santos
Lucas Santos
19,315 Points

How can I check the value of a variable/expression in Android Studio. ("Evaluate Expression" is not working)

I am trying to quickly check the value of a variable in Android Studio. I have seen a video here on treehouse of someone using "Evaluate Expressions" to check the value of a variable or expression.

For some reason the option to "Evaluate Expression" is disabled in a grey color and I am not able to use it. If someone knows how to get it to work or another method to checking expressions that would be great.

I would also use System.out.println() but that wont work in Android Studio.

Thank you.

1 Answer

Hi Lucas,

You may be able to get what you're looking for by running your app in debug mode with the line containing the variable marked in the gutter. After the code which sets that variable has run, then you should be able to hover your mouse over the variable to see what its current value is.

Hope that helps!

Lucas Santos
Lucas Santos
19,315 Points

Turned on debug, marked the variable in the gutter as "break" hovered my mouse over the variable and nothing.