How to program outside the main UI thread
问题 I don't know if a UI thread exists by default, how to create it if not, or how to tell when I'm "in" it where it begins and ends if so. How do I make sure PacketListener isn't part of the main UI thread? I keep running into this NetworkOnMainThreadException . I understand that means that I'm trying to do something in the main UI thread that should have its own separate thread. However, I can't find much to tell me HOW to actually do that. I had thought that the MainActivity class would BE the