问题描述
|
我想知道从哪里可以看到程序使用的变量的所有值。我知道使用Log()可以看到将它放置在代码中,这些代码的值是已知的。但是我不想遍历代码,我希望在程序中声明所有变量的所有值。
例如,
String addressstring = \"No address found\";
double lat = location.getLatitude();
double lng = location.getLongitude();
Geocoder gc = new Geocoder(this,Locale.getDefault());
try {
List<Address> addresses = gc.getFromLocation(lat,lng,1);
StringBuilder sb = new StringBuilder();
if (addresses.size() > 0) {
Address address = addresses.get(0);
sb.append(address.getCountryName());
}
addressstring = sb.toString();
在此我想知道将存储在变量addressstring,lat,lng中的值。
但不使用Log()。
在这种方法中,我可以查看。如果有人能理解,请给我答复。
解决方法
您使用什么思想?在Eclipse中,我们可以在调试模式下启动项目,并在运行时查看变量的值(调试视图->变量)。您一定不要忘记将清单文件放入可调试的true。
,是的你可以。在Eclipse上以调试模式运行应用程序,然后在要停止的位置添加一个断点并检查变量。您可以将鼠标移到它上面以查看其值,也可以使用变量调试窗口。
检查一下:
http://www.droidnova.com/debugging-in-android-using-eclipse,541.html
,在Eclipse中,使用调试器。声明您的项目在androidmanifest中是可调试的,并在代码中放置一个断点,您不想读取变量!
祝好运