DSlomer64 DSlomer64 - 9 days ago 5
Android Question

Break on variable value change in Android Studio 1.1.0?

I know I could set a breakpoint at every line where my code changes the variable, but is there an option such as right-clicking a variable (to "Add to Watches") that would stop when a variable changes value?

I think C++ has this option. See this.

And Eclipse? See this.

Is this implemented in AS?

Answer

You can break on value changes of some variables in Android Studio 1.1.0.

Android Studio calls them 'Java Field Watchpoints'.

From the breakpoints windows, (Run -> "View breakpoints...") or Ctrl+Shift+F8, you can add "Java Field Watchpoints" from the plus in the top left corner, and then select your class and variable.