gallien
gallien

Reputation: 131

Spy / Watch variable in Android (Eclipse)

I am new to Android development with Eclipse. I am asking a very basic question : is it possible to watch / spy the content of a variable during the debugging session? (a bit like in Visual Studio)

I know It is a fairly lame question, but I couldn't figure it out myself.

thanks in advance,

Gallien

Upvotes: 2

Views: 9867

Answers (5)

CodeShadow
CodeShadow

Reputation: 3652

The most easiest way, is to hover over the variable name while debugging and it shows you the whole object. I work on eclipse kepler latest version.

enter image description here

Upvotes: 0

Imran Rana
Imran Rana

Reputation: 11899

First select Debug perspective as:

enter image description here

Then set Breakpoints at places you want:

enter image description here

After that create a Debug configuration via Debug As->Debug Configurations... and then Debug as Android Application as shown below: enter image description here

Then in Debug perspective you can trace/watch value of your desired variable by pressing F8: enter image description here That's it, you can also evaluate expressions through Expressions view. If it is not enabled select it from: Window->Show View->Other->Debug->Expressions.

Upvotes: 10

john jiang
john jiang

Reputation: 61

When you have open debug perspective, click window->show view->expressions. After that, you can input a variable name manually. You can select a variable in code then right click, there will be a link named 'watch'. You'll get it!

Upvotes: 0

Everyone
Everyone

Reputation: 2376

Yes, you may view variables whilst debugging.

To set a watch point, select a variable in the 'Outline' view in the 'Debug' perspective. Right click the variable, and press 'Toggle Watchpoint'.

More information available here

Upvotes: 0

mihail
mihail

Reputation: 2173

you can use the Expressions tab in the debug perspective. Also you can observe the variable when you hit a breakpoint - check this link: http://www.ibm.com/developerworks/library/os-ecbug/

Upvotes: 0

Related Questions