Log in debug only?

by Pamplemousse Mk2 » Thu, 30 Jul 2009 16:06:40 GMT

Sponsored Links

I write a lot of logs in my program with the class android.util.Log.
Do the log methods (Log.v(), Log.d(), ...) are executed on the phone?
When my program will be finished, I won't like to see it try to output
logs in the release version.

I have seen that to make a conditional compilation (for Debug/Release
version), I can use a class like this:

public final class Debug {
          //set to false to allow compiler to identify and eliminate
          //unreachable code
          public static final boolean ON = false;

and use if to add debug codes:

if (Debug.ON) {
  // Do debug works...

If Debug.ON is false, the compiler removes the unreachable parts of
code, i.e. the ones inside this if. Should I do the same for Log
functions to be able to activate and deactivate them?


Other Threads

1. Can we develop android apps in C or C++?

Hi All,

I am very new to android and also for JAVA. Untill now i am working on
Is there any way to develop the Android apps on "C" or "C++".
Please let me know, whether it is possible or not.

Thanking you all,



2. It there a bug in the1.6 Emulators in landscape mode ?


      I have started the QVGA and WVGA800 emulators from Eclipse.  I
am using Windows XP.   I pressed Ctrl-F12 to put them in landscape
mode.  Then tried to bring up the Android keyboard, but it will not
popup.  This is preventing me from testing my own input method.

      Can someone verify if they also have this problem or is it just
my setup ?

Thanks !



3. happy diwali

4. Does there exist a Google Search APP widget? How to use own Launcher and Google Search

5. ListActivity.onListItemClick(...) not being invoked

6. Help USB debug mode

7. Android put rectangles on camerasurface