在 Android 的 TextView 中获取 Log.i 的结果

Get results for Log.i in a TextView in Android

我们如何在 TextView 中检索和显示 LogCat 中的示例消息?

Log.i(LOG_TAG, "Layer Direction : " + direction);
Log.i(LOG_TAG, "Layer ShortPD : " + pr);
Log.i(LOG_TAG, "Layer Stack : " + stackL3);
Log.i(LOG_TAG, "Layer Header : " + msgL3);
Log.i(LOG_TAG, "Layer Data : " + strData);
Log.i(LOG_TAG, "Layer BCCH : " + bcchString);

所以,我在 LogCat 中显示这些消息,现在我想在我的应用程序中的某些 TextView 中显示它们。

只需在布局中找到您的文本视图并键入

textView.setText( "Layer Direction : " + direction);
... 

参考这个 link。 http://www.tutorialspoint.com/android/android_textview_control.htm

按照以下步骤操作: 1] 创建 XML 来定义文本视图。 2] 创建 Activity Class 用于在 TextView 上设置文本。