如何在java中记录库变量?

如何在java中记录库变量?,java,android,debugging,logging,libraries,Java,Android,Debugging,Logging,Libraries,我想在外部库中记录一个变量值(android中的AppCompat) 有可能吗?我知道我可以点击一个断点并检查一个值,但我想检查许多触摸事件回调,这些回调很难用这种方式进行调试 例如,代码是: int setHeaderTopBottomOffset(协调布局父项、V标头、int newOffset、, int minOffset,int maxOffset){ final int curOffset=getTopAndBottomOffset(); int=0; 如果(minOffset!=

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

有可能吗?我知道我可以点击一个断点并检查一个值,但我想检查许多触摸事件回调,这些回调很难用这种方式进行调试

例如,代码是:

int setHeaderTopBottomOffset(协调布局父项、V标头、int newOffset、,
int minOffset,int maxOffset){
final int curOffset=getTopAndBottomOffset();
int=0;

如果(minOffset!=0&&curOffset>=minOffset&&curOffset您可以在IDEA中通过在感兴趣的行上设置断点来实现这一点,然后右键单击断点,取消选中
Suspend
选项,并用类似
log.d(标记,调试消息)的内容填写
评估和记录

请提供具体细节。
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;
 }