Android controller in different threads - codesd.com
source link: https://www.codesd.com/item/android-controller-in-different-threads.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Android controller in different threads
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.
Related Articles
Android how to run a service in a different thread
Changing an Android view from a different thread
Android design: how to run 3 different threads in the background for monitoring 3 different devices
Access to the database from different threads in Android
How do I create an Android notification on another thread?
Execute methods on different threads
How do I access a DataGrid created on a different thread in a UI thread?
QObject :: setParent: Unable to set parent, new parent is in a different thread
Does this code run in a different thread than the main UI thread?
Android Instrumentation Test - UI Thread Problems
Loading the user interface on a different thread in Swift
fsync () and write () in different threads
Safely add / remove the ListView item from different threads
How to access the session in MVC.Net 4 from different threads
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK