如何在 Android Studio 中放置手表(查看变量是如何修改的)? [英] How to put a watch (see how a variable is modified) in Android Studio?

查看:28
本文介绍了如何在 Android Studio 中放置手表(查看变量是如何修改的)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何在 Android Studio 中使用手表.我想看看一个变量的值是如何通过调试修改的.有人知道怎么做吗?

I don't know how to use a watch in Android Studio. I want to see how the value of a variable modifies through debugging. Does anyone know how to do this?

推荐答案

首先在要观察特定变量的类中放置一个断点.运行代码,一旦它从变量"窗口框架命中您的断点,您应该会看到所有可访问的变量.只需选择您想观看的内容,然后右键单击并从下拉列表中选择添加到观看".

Start by putting a break point in the class where you'd want to watch a specific variable. Run the code and once it hits your breakpoint from the Variables window frame you should see all of the variables that are accessible. Simply choose the one you'd want to watch and then right click and choose "Add to watches" from the drop-down.

继续调试,您应该会根据您的代码在适当的时候看到 Watches 窗口框架中的变量更新.

Keep debugging and you should see the variable from the Watches window frame update when appropriate based on your code.

这篇关于如何在 Android Studio 中放置手表(查看变量是如何修改的)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆