java - 为什么我在LogCat中看不到System.out.println?

标签 java android

如标题所述,为什么我看不到System.out.println LogCat 中的输出?这是我的代码,不起作用。我使用 Android Studio (v.0.8.2)。

编辑:将 log.i 添加到代码中不会在 logcat 中返回任何内容。

这是我的日志

enter image description here

这是我的代码

private static final String TAG = "MyActivity";

/*

*/

public void mButton(View view) {
    URLConnection nbpUrl;
    String data = "";
    try {
        nbpUrl = new URL("http://www.nbp.pl/Kursy/xml/dir.txt").openConnection();
        InputStream is = nbpUrl.getInputStream();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        String inputLine;
        while ((inputLine = reader.readLine()) != null) {
            if (inputLine.startsWith("a") && inputLine.endsWith("140807")) {
                System.out.println(inputLine);
                data = inputLine;
                Log.i(TAG, "test");
            }
        }
        is.close();
    }
    catch(Exception e){
        e.printStackTrace();
    }
    poleTextowe = (TextView)findViewById(R.id.pole1);
    poleTextowe.setText(data);
}

最佳答案

不要使用系统输出 println。 Android有自己的Logger类(class)。请参阅该文档。

关于java - 为什么我在LogCat中看不到System.out.println?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25263892/

相关文章:

java - 使用 Stream 并行执行 100 次,无需循环计数器

java - ZMQ 丢失事件在 jeromq scala 中传播

android - 如何在android中将透明背景设置为自定义对话框

Android - 3D "stacked"图库图像

android - 从不同的 Activity 中调用函数

android - 调用需要 API 级别 21(当前为 14)

java - MVC 数据库图像显示 spring

java - Android 堆栈溢出错误

java - 使用 Ant 进行多次 war 构建

java - 每 x 毫秒执行一次的代码,可更改