I am working on an android app. I am able to run the app in a virtual device perfectly. However, I don't want to do this every time. I want to also use system.out.println to print things out in an area of eclipse telling me what is basically working in the program, without just trying it with the virtual device alone. Basically, i use system.out.println in my app but I dont know where it is being displayed. Thanks
-
Close to http://stackoverflow.com/questions/2220547/why-doesnt-system-out-println-work-in-android That should point you in the right direction. – bschultz Mar 08 '12 at 18:57
4 Answers
You should use android.util.Log
class to print the log messages. You can view these message either in DDMS perspective of Eclipse or via adb logcat
command

- 7,611
- 3
- 29
- 38
For System.out.println
while doing Android apps, Toast seems to be the closest you can get: http://developer.android.com/guide/topics/ui/notifiers/toasts.html
I generally use println
to see if a block of code executes, or to do a quick check that a variable has this value, etc. For these, Toast suffices for my purposes although by nature it isn't as fast println
.

- 11,467
- 7
- 43
- 61
However, I don't want to do this every time.
You can only run Android applications in Android. So, you need to run your app on a virtual device using the emulator, or on Android hardware.
I want to also use system.out.println to print things out in an area of eclipse telling me what is basically working in the program, without just trying it with the virtual device alone.
You are welcome to use the Log
class to emit things to LogCat to view in Eclipse. However, the code that uses Log
must run on a virtual device using the emulator or on Android hardware.

- 986,068
- 189
- 2,389
- 2,491
You can deploy your app to an actual device connected to your development machine through a USB connection. Then any logging or printing done with System.out.println will appear in the Eclipse logcat view just as when you are deploying to the emulator.
The following link will help you configure your USB connection for specific devices:
http://developer.android.com/sdk/oem-usb.html

- 3,371
- 1
- 19
- 21