【问题标题】:Does Sytem.out.println work in Android? [duplicate]System.out.println 在 Android 中工作吗? [复制]
【发布时间】:2011-08-15 15:15:06
【问题描述】:

可能重复:
Why doesn't System.out.println work? (in Android)

我想在控制台中打印一些东西。我能做些什么?因为 System.out.println 不起作用。有些人说它有效,但有些人说它无效。哪一个对? 谢谢

【问题讨论】:

    标签: android printing android-logcat


    【解决方案1】:

    您应该使用 android SDK 中的 Log 类。 http://developer.android.com/reference/android/util/Log.html

    喜欢

    final string tag = "myApp";
    Log.d(tag,"hello world");
    

    【讨论】:

      【解决方案2】:

      System.out.println() 有效,Log.d("TAG", "message"); 也有效,但您需要在 eclipse 中打开 LogCat 视图,不是控制台视图。

      【讨论】:

        猜你喜欢
        • 2014-09-25
        • 2023-03-27
        • 2014-12-14
        • 2013-07-08
        • 2020-03-19
        • 1970-01-01
        • 1970-01-01
        • 2011-01-14
        • 2013-09-19
        相关资源
        最近更新 更多