Console window ( System.out.println(...); )

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

Console window ( System.out.println(...); )

Postby venkat » Tue Nov 27, 2007 5:53 am

hi to all,
any one tell me how to print message on console window.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. System.out.print("message");
Parsed in 0.029 seconds, using GeSHi 1.0.8.4

this method is not working properly.

thanks.
venkat
Senior Developer
Senior Developer
 
Posts: 152
Joined: Tue Nov 27, 2007 5:42 am
Location: India

Top

Postby plusminus » Tue Nov 27, 2007 9:15 am

Hello venkat,

System.out.println is not working on Android, but there is sth at least same powerful 'replacement':
The so called 'LogCat'.

If you are using Eclipse, then you can goto Windows-> Show View -> Android -> LogCat.
- It should be visible in the DDMS-View by default
How to get to the DDMS-View (B if A is not visible):
Image


If you are using the Command-Line:
- Browse the tools directory of your Android-SDK and...
- use: ` adb logcat `

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. android.util.Log:
  2.    Log.v (for verbose)
  3.    Log.d (for debug)
  4.    Log.i (for info)
  5.    Log.w (for warnings)
  6.    Log.e (for errors)
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Usage in your code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private static final String TAG = "MyActivity";
  2. Log.v(TAG, "index=" + i);
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


Hope I could help.

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

Thank u very much

Postby venkat » Tue Nov 27, 2007 11:10 am

Thank u very much, this is what i am looking for. :)
venkat
Senior Developer
Senior Developer
 
Posts: 152
Joined: Tue Nov 27, 2007 5:42 am
Location: India

Postby rmeph » Fri Dec 21, 2007 7:17 am

if i have
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private EditText firstnameText;
  2.  
  3.  firstnameText = (EditText) findViewById(R.id.firstname);
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


i see that value i used
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private static final String TAG = "MyActivity";
  2.  
  3. Log.v(TAG, "firstnameText =" + firstnameText );
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


but it's not display in logcat.......
how to see that value?
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby plusminus » Fri Dec 21, 2007 4:24 pm

Hello rmeph,

I assume that you want to get the Text typed within the EditText, right :?:
So you need to extract the Text out of the EditText first:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private static final String TAG = "MyActivity";
  2. private EditText firstnameText;
  3.  
  4. firstnameText = (EditText) findViewById(R.id.firstname);
  5.  
  6. String s = firstnameText.getText().toString();
  7. Log.v(TAG, "firstnameText =" + s );
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


Or did it show nothing in the LogCat :?: (Really nothing or just not the one Log.v(...) from above :?: )

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 LW » Wed Jan 02, 2008 10:56 am

Is there any other solutions to do that "easy java task" coz it works but on the log cat there are too many information lines in addition with the thing you want to display.
LW
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Dec 31, 2007 2:05 pm

Top

Postby plusminus » Thu Jan 03, 2008 4:23 pm

Hello LW,

Use Filters to control/filter the LogCat-Output:
Image


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 beausejour » Wed Apr 16, 2008 10:15 am

Just read this post
http://groups.google.com/group/android- ... 1e52b26c73

After remove all lylyn file, the logcat works
beausejour
Junior Developer
Junior Developer
 
Posts: 18
Joined: Tue Apr 15, 2008 4:04 pm
Location: France

Postby zeeshan » Tue Apr 22, 2008 6:24 am

how can we configure logging if we are not in development phase
zeeshan
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Mar 03, 2008 6:10 am

Postby manjul_saini » Mon Aug 10, 2009 1:23 pm

hi all, i went through above post and tried, but was unable to pring any logs

Log.v("=bowlY eggY=", "n+315-50 "+(n+315-y));

will any body help me please , i really need to print the output on log/console.
Thanks and Regards,
Manjul
User avatar
manjul_saini
Freshman
Freshman
 
Posts: 4
Joined: Mon Aug 10, 2009 6:28 am
Location: New Delhi/Gurgaon

Re: Console window ( System.out.println(...); )

Postby vycon » Sun May 23, 2010 10:14 pm

It helps me a lot! That's what I am looking for! Thanks
vycon
Freshman
Freshman
 
Posts: 7
Joined: Sun May 23, 2010 4:03 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 20 guests