如何编写控制台消息? [英] How to write Console message?

查看:92
本文介绍了如何编写控制台消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android.我用过:

Android. I used:

import android.util.*;
......
Log.d("MyActivity", "Debug output");


但这不会在控制台中显示任何内容.我还可以使用什么呢?


but this not show anything in console. What else may I use?

推荐答案

您需要研究使用Java进行标准IO. 有System.in System.outSystem.err,请在这里阅读有关它们的信息: Java IO :System.in,System.out和System.err [
You need to look into doing standard IO with java.
There are System.in System.out and System.err please read about them here: Java IO: System.in, System.out, and System.err[^].

System.out.println("Debug output");



[修改]
我在SO上找到了这一点,它在一个解决方案中表示,将Android System.out和System.err中的重定向到/dev/null,有效地将所有输出发送到了必杀技.请阅读有关SO的详细信息:
是否可以在Android应用程序中打印到控制台? [ http://developer.android.com/tools/help/adb.html#logcat [^ ]
[最终修改]

问候,

—曼弗雷德(Manfred)



[Modification]
I found this bit on SO where it says in one solution that in android System.out and System.err are redirected to /dev/null, effectively sending all your output into nirvana. Please read the details on SO: Is there a way to print to the console in an Android app?[^]

There is also an promising link sending you to this site: http://developer.android.com/tools/help/adb.html#logcat[^]
[End Modificiation]

Regards,

— Manfred


这篇关于如何编写控制台消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆