如何在java中记录库变量?

时间:2017-05-22 04:26:04

标签: java android debugging logging libraries

我想在外部库中记录变量值(android中的AppCompat)。

有可能吗?我知道我可以点击一个断点并检查一个值,但是我想检查一下很难以这种方式调试的触摸事件回调

例如,代码是:

int setHeaderTopBottomOffset(CoordinatorLayout parent, V header, int newOffset,
    int minOffset, int maxOffset) {
    final int curOffset = getTopAndBottomOffset();
    int consumed = 0;

    if (minOffset != 0 && curOffset >= minOffset && curOffset <= maxOffset) {
          // If we have some scrolling range, and we're currently within the min and max
          // offsets, calculate a new offset
          newOffset = MathUtils.constrain(newOffset, minOffset, maxOffset);

          if (curOffset != newOffset) {
              setTopAndBottomOffset(newOffset);
              // Update how much dy we have consumed
              consumed = curOffset - newOffset;
          }
      }

      return consumed;
 }

我希望在curOffset != newOffset时记录案例并注销curOffsetnewOffset

1 个答案:

答案 0 :(得分:0)

您可以在IDEA中通过在您感兴趣的行上设置断点来执行此操作,然后右键单击断点,取消选中Suspend选项并使用{{1}填写Evaluate and log }}