i have a class,
class myapp // for example
{
// some variables used by UI and telnet class
// i.e. my edit text controls and telnet object
oncreate()
{
// initiate UI elements like 2 edittext controls and ascroller and a button
// start telnet thread
}
class telnet {
// telnet can post new messages to edittext window through handler
}// end telnet
}// end program
the problem is when oncreate is called again, like they flip the phone, by default it recreates the telnet thread and the users if forced to reconnect.
i checked if savedinstancestate is not null and tried to bypass this, but then it just stops. It's like the old telnet thread is no longer connected to the UI if i don't restart it, though from what i can tell they are still connected.
I see there are ways to add data to saved instance state, but the methods are like add a Boolean or add a string, i don't see how to save my telnet object that is represented by a nested class. And I'm not sure even if i did that, if it would keep the socket open.