5

I want to know where the output of System.out.printf will be shown in Android Studio

package com.example.kakashi.gesture1;

import android.support.v4.view.MotionEventCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;

public class MainActivity extends AppCompatActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
  }

  public void printSamples(MotionEvent event){
    int historySize = event.getHistorySize();
    int pointerCount = event.getPointerCount();
    for (int i=0;i<historySize;i++) {
      System.out.printf("At time %d",event.getHistoricalEventTime(i));
      for (int p=0;p<pointerCount;p++){
        System.out.printf("pointer %d ( %f,  %f                                                                             )",event.getPointerId(p),event.getX(p),event.getY(p));
      }
    }
  }
}
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
Shivansh Pradhan
  • 89
  • 1
  • 1
  • 2
  • 1
    Check the logcat (Android Monitor) Also i suggest use the `Log` class for this purpose. – Rashin Jul 10 '16 at 08:07
  • Does this answer your question? [How to print to the console in Android Studio?](https://stackoverflow.com/questions/16780294/how-to-print-to-the-console-in-android-studio) – Josh Correia Jul 02 '20 at 22:28

3 Answers3

25

You can see the println statements in Run window as shown below screenshot. so you can see the prinln statements in that window.

For example if I wanna see Strings which are in for loop then:

enter image description here

Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138
  • 2
    I am going to up vote because it seems that this is actually the only answer that answers this question. I have a need to print out to the console since I am trying to parse log files on a rooted device. Logging the messages that I see in Logcat only make the buffer fill up faster. – Droid Chris Oct 27 '17 at 15:08
3

In the bottom of Android Studio IDE there is Android Monitor. Click it.

Then you can check your System.out.printf output in logcat tab there. Play around with list of Debug, Error, Info, etc.

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
2

if you are using System.out.printf it will be shown in android studio console but if you are using Log.e(...) or etc it will be shown in logcat.

pouyan
  • 3,445
  • 4
  • 26
  • 44