我正在使用一个MainActivity和另一个包含类的.java。
我希望能够在MainActivity中的textView中设置我的排除类的Logs或System.out。
例如我的类中此方法的System.out:
private class Util {
private static KNXNetworkLinkIP connect(InetSocketAddress isaLocalEP, InetSocketAddress isaRemoteEP)
{
KNXNetworkLinkIP netLinkIp = null;
int serviceMode = KNXNetworkLinkIP.TUNNEL; // tunnel to IP router
boolean useNAT = true; // NAT not used for PC true or false , but needed for emulator = true
KNXMediumSettings tpSettings = new TPSettings(true); // TP1 medium
try
{
// Output the local end point address
if (m_debugOutput == true)
{
System.out.println("..Tunneling, NAT ignored, TP1 medium");
// Should be the PC's VPN address
System.out.print("..Local EP:");
System.out.println(isaLocalEP.getHostName() + ":" + isaLocalEP.getPort());
System.out.print("..Remote EP:");
System.out.println(isaRemoteEP.getHostName() + ":" + isaRemoteEP.getPort());
System.out.print("..useNAT:");
System.out.println(useNAT);
System.out.println();
}
netLinkIp = new KNXNetworkLinkIP(serviceMode, isaLocalEP, isaRemoteEP, useNAT, tpSettings);
}
catch (KNXLinkClosedException e)
{
System.out.println("connect:KNXLinkClosedException = " + e.getMessage());
}
catch (KNXFormatException e)
{
System.out.println("connect:KNXFormatException = " + e.getMessage());
}
catch (KNXException e)
{
System.out.println("connect:KNXException = " + e.getMessage());
}
catch (Exception e)
{
System.out.println("connect:Exception = " + e.getMessage());
}
return netLinkIp;
} // connect(isaLocalEP, isaRemoteEP)
}
我知道这是一个简单的问题,但我被困住了,不知道如何实现它......
答案 0 :(得分:2)
你可以使用Log.x()
方法记录,然后读取系统日志,grep只获得你的显示,或者编写自己的记录器,将你的日志放入数据库,然后你的其他代码可以获取并显示它