Android version of C # Console.WriteLine?

In Android, what is best written on the console. In C #, I would use either Log4Net or just Console.Write

+6
android
source share
4 answers

Check out the Android.Util.Log help pages.

You can use:

Log.v("MyActivity", "Verbose output"); Log.d("MyActivity", "Debug output"); Log.e("MyActivity", "Error output"); Log.i("MyActivity", "Information output"); Log.w("MyActivity", "Warning output"); Log.wtf("MyActivity", "WTF output"); // This isn't a joke :) 
+13
source share

For simple debugging, a standard Java method is sufficient:

 System.out.println("Message"); 
+2
source share

As @Dan Dyer notes, System.out.println(yourString); will be good. But do not expect it to appear in the console on which the emulator is running. You will have to search your result in logcat. (This screen saver has a tab for it in eclipse.)

enter image description here

+1
source share

You need to learn how to debug in Eclipse and how to use ADB and DDMS .

To get more detailed information on exception / strength, you need to look for a view in Eclipse called Logcat (you will find in DDMS ) there you will find a detailed trace of when / what and in which line the problem is.

To do this, you should read the full article on Debugging in Android with Eclipse

alt text http://www.droidnova.com/blog/wp-content/uploads/2009/09/debugging-3.gif

+1
source share

All Articles