2

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

gallien
  • 121
  • 1
  • 3
  • 11
  • Have you looked at this question: http://stackoverflow.com/questions/575336/how-to-detect-when-a-variable-changes-value – Display name May 10 '12 at 09:23

5 Answers5

10

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.

Imran Rana
  • 11,899
  • 7
  • 45
  • 51
0

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/

mihail
  • 2,173
  • 19
  • 31
0

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

Everyone
  • 2,366
  • 2
  • 26
  • 39
0

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!

john jiang
  • 61
  • 1
  • 8
0

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

CodeShadow
  • 3,503
  • 1
  • 17
  • 16