Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.