I am using one MainActivity and another .java which includes a class.
I want to be able to set the Logs or System.out from my excluded class in a textView inside my MainActivity.
For example the System.out from this method inside my class:
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)
}
I know this is a simple question but I am stucked and do not know how to realize it…..
You could either log using
Log.x()methods and then read system logs, grep to obtain just yours and display, or write own logger that would put your logs into i.e. database and then your other code could fetch and display it.