http://www.developer.com/http://www.developer.com/ws/android/development-tools/android-ddms-powerful-debugging-tool-for-android-app-testing.html
In this increasingly fragmented and complex world of Android application development, thoroughly testing your Android app is becoming a real challenge. One of the biggest headaches is how to test your Android app in all the conceivable real-world scenarios. To make matters worse, most Android app development scenarios are mobile-specific, and will be unfamiliar to developers who have previously dealt only with desktop and Web environments. Will your Android app freeze when a text message or phone call comes through? How will it perform under fluctuating network speeds, or when the signal drops? You may have an Android device with your targeted operating system on hand, but you'll still struggle to recreate every possible situation, which is why the emulator has become the Android developer's best friend. But even Android emulators have their limitations, and the testing phase is crucial to the success of your Android app. The good news for Android developers is that once you have the Android SDK and ADT plugin installed, you'll have access to one of the most powerful debugging tools out there: the Dalvik Debug Monitor Server (DDMS.) The DDMS is an invaluable tool for checking the memory usage of your Android app, drilling down into errors, simulating a range of real-world conditions, and much more. The DDMS can analyze an Android project running in the emulator, or it can be connected to a real device (if both are connected, the DDMS will default to the emulator.) To access the DDMS, open the Window menu and select Open Perspective. Select Other, which will present you with a list of additional options. Select DDMS. This will bring up the DDMS perspective with the default views (note that you can always access additional views by opening the Window menu and selecting Show View). In this article, I'll take you through these different DDMS views and explain why they're so important for Android development. This is where Android collects and displays a stream of system messages and diagnostic data. When you run your app, the Log class automatically prints messages to LogCat alongside other output data, such as stack traces. It's possible to filter these log messages, which is useful if you're after a specific item. Select the green Plus sign to bring up the LogCat Message Filter Settings dialog, and enter your search parameters. The Devices view lists the devices and emulators that are online, alongside the processes that are running in each instance. This view is useful for getting an overview of your different projects. The Devices tab also provides easy access to some common debugging operations. Select the item you wish to explore in the Devices view; this will open a menu where you can access the following shortcuts: Android's Dalvik runtime is garbage collected, but memory management should still be on your list of priorities. Neglecting memory management leads to hanging objects and eventually to memory leaks. The Allocation Tracker provides an insight into allocations that are occurring in real time. To start tracking the memory allocation of objects, you: When you are ready to analyze the collected data, click Get Allocations to bring up a list of all the objects that have been allocated since you enabled tracking. Your app may run perfectly in your IDE, but it isn't destined for a life on the desktop. The Emulator Control view is a powerful tool for testing your app under real-world conditions. The different options available as part of the Emulator Control tab are: The File Explorer allows you to view files, and to copy them between the emulator and the device, in a similar way to the abd Are you forever running out of memory? Then it's time to find out exactly what objects are being created. The heap view can be used to analyze memory usage and to manually invoke garbage collection. To invoke garbage collection and update the heap with the latest memory analysis, you: Once the operation has been completed, you will see a group of object types, alongside the memory that has been allocated for each object. The thread view allows you to access the thread information for a selected process. To check thread information, open the Devices tab and select the process you wish to view thread information for. Then, it's simply a matter of clicking Updates Thread and opening the Threads tab. At this point you may receive a "Thread updates not enabled for selected client (use toolbar button to enable)" message. You can easily rectify this by opening the Windows menu, selecting Preferences and Android, followed by DDMS. Check the Thread Updates Enabled by Default box. Your thread information should now display correctly. The Network Statistics tab is useful for tracking when your app is making network requests. Monitoring data transfers (in particular how and when they occur) allows you to modify your app to optimize network usage and battery efficiency. This article has covered the core functionality DDMS offers Android developers. When testing your app, bear in mind that although selecting the DDMS perspective will bring up the default views, you can easily add additional views by opening the Window menu and then Show View, as needed. Or, if you just want to reorganize the DDMS layout, this is simply a matter of dragging and dropping the different panes around your dashboard.
Android DDMS: Powerful Debugging Tool for Android App Testing
May 22, 2012
Firing Up the DDMS

Android DDMS View # 1: LogCat

Android DDMS View #2: Devices


Android DDMS View #3: Allocation Tracker

Android DDMS View #4: Emulator Control

Android DDMS View #5: File Explorer
pulland push commands.Android DDMS View #6: Heap View

Android DDMS View #7: Threads

Android DDMS View #8: Network Statistics

Conclusion