开发者

How can i have a look at the variables and its values during execution..?

I want to know from where can i see all the values of the variables that my program uses. i know that using Log() i can see it placing it in the code ,where the开发者_Python百科 values is to be known.But i dont want through the code,i want all the vales of all the variables declared in the program.

For example,

                   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();

In this i want to know the values that will be stored in variables addressString,lat,lng. But without using Log(). In there such method where i can view that. If anyone understood this please reply me.Thanks in advance.


What ide do you use? In Eclipse we can launch project in debug mode and see value of variables in runtime (Debug View -> Variables). You must not forget to put in the manifest file debuggable true.


Yes you can. Run application in debug mode on Eclipse, and add a breakpoint to where you want it to stop and check for variables. You can the pass the mouse over it to see it value or use the variable debug window for that.

Check this: http://www.droidnova.com/debugging-in-android-using-eclipse,541.html


In eclipse, use the debugger. Declare you project to be debug-able in the androidmanifest, and place a breakpoint in the code where you wan't to read the variables!

Good luck

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜