Debug Tricks

Posted: November 2, 2009 in Android, Java, Mobile
Tags: ,

A debug trick

public stackTraceOrHeapDumpConstructor(String LOG_TAG, String someName) {
boolean mLoggable = Log.isLoggable(LOG_TAG, Log.DEBUG);
		if(mLoggable=true){
                    the stacktrace(someName) or heap dump here
                } else {
               }
}

Now your stacktraces and Heapdump statements are not enabled if debugging is off.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s