[Solved] System.out.println

Put your problem here if it does not fit any of the other categories.

[Solved] System.out.println

Postby benny! » Thu Feb 14, 2008 6:26 pm

Hi,

sometimes I prefer to output something to the
console (ja, I know there are better ways to
debug). But it doesnt work. For example, if I
modify a HelloWorld app to the following:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import android.app.Activity;
  2.  
  3. import android.os.Bundle;
  4.  
  5.  
  6.  
  7. public class HelloWorld extends Activity {
  8.  
  9.     /** Called when the activity is first created. */
  10.  
  11.     @Override
  12.  
  13.     public void onCreate(Bundle icicle) {
  14.  
  15.         super.onCreate(icicle);
  16.  
  17.         System.out.println("This is a test .... ");
  18.  
  19.         setContentView(R.layout.main);
  20.  
  21.     }
  22.  
  23. }
  24.  
  25.  
Parsed in 0.045 seconds, using GeSHi 1.0.8.4


Nothing is printed to the console ? Any ideas what
I am doing wrong here ?

Thanks in advance,
greetz,
benny!
Last edited by benny! on Fri Feb 15, 2008 11:55 am, edited 1 time in total.
User avatar
benny!
Experienced Developer
Experienced Developer
 
Posts: 69
Joined: Tue Nov 27, 2007 3:36 pm
Location: end of www

Top

Postby res » Thu Feb 14, 2008 7:31 pm

You need to use the android.util.Log class, doc: http://code.google.com/android/referenc ... l/Log.html

So instead of System.out.println you use Log.i for example.

Edit: with Eclipse this should output to the console, you can also adb shell from the command line to access the emulator and then run 'logcat' to see the output.
res
Senior Developer
Senior Developer
 
Posts: 146
Joined: Tue Nov 20, 2007 8:14 pm
Location: United States

Postby benny! » Thu Feb 14, 2008 8:55 pm

@res:

Thanks, res. I will try this out!
User avatar
benny!
Experienced Developer
Experienced Developer
 
Posts: 69
Joined: Tue Nov 27, 2007 3:36 pm
Location: end of www

Postby res » Thu Feb 14, 2008 9:28 pm

No worries :D
res
Senior Developer
Senior Developer
 
Posts: 146
Joined: Tue Nov 20, 2007 8:14 pm
Location: United States

Postby plusminus » Fri Feb 15, 2008 11:47 am

Hello benny,

I had explained that somewhen :arrow: viewtopic.php?p=284#284

LogCat is basically much more powerful :!: ( but from time to time shows just nothing :( )

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby benny! » Fri Feb 15, 2008 11:54 am

plusminus wrote:Hello benny,

I had explained that somewhen :arrow: viewtopic.php?p=284#284

LogCat is basically much more powerful :!: ( but from time to time shows just nothing :( )

Regards,
plusminus


Cool. Thans a lot - and sorry for not finding your original thread.
User avatar
benny!
Experienced Developer
Experienced Developer
 
Posts: 69
Joined: Tue Nov 27, 2007 3:36 pm
Location: end of www

Top

Postby plusminus » Fri Feb 15, 2008 12:16 pm

benny! wrote:Cool. Thans a lot - and sorry for not finding your original thread.


The search-function of phpBB2 is shitty :? ^^

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 13 guests