Android controller in different thread
I´ve heared that the main Activity should run in a different thread than the actual program. Whats the best practice there, where should I start a new thread. I have a controller that starts and organizes some stuff, should I run the controller already in a different thread?
The point to know is that all callbacks in an Activity run on the UI thread, and you should not do any lengthy work on the UI thread. Otherwise, you will compromise the responsiveness of the UI and possibly cause an ANR.
If you need to do any kind of lengthy operation, like some serious number crunching, downloading data from a remote server that involves making blocking calls, etc. then you should perform it on a new, non-UI thread.
ANR = Application Not Responding ;-)