Closed EMIN3M1986 closed 7 years ago
It's not allowed to run networking code in the main app thread on android. To fix your example you need to call thread.start() instead of thread.run(). To undetstand the difference read javadocs of these methods or some article like this: http://javarevisited.blogspot.com/2012/03/difference-between-start-and-run-method.html.
What @atfire says. Connect in a separate thread.
Hi. I use Lyra in a Service and create Connection on a new thread. But when this line goes to execute
it shows me this error. android.os.NetworkOnMainThreadException
What is the reason ?