怪我咯2017-04-17 17:18:30
Handler is mainly used for asynchronous message processing.
If it is all on the main thread, I personally think it is not necessary
PHP中文网2017-04-17 17:18:30
This is definitely possible, but whether it is necessary depends on personal habits.
阿神2017-04-17 17:18:30
It can all be in the main thread. It can be used when doing some linkage. It may also be used when customizing controls
怪我咯2017-04-17 17:18:30
Yes.
You can only tell whether it is necessary based on the business. I have to say it’s not necessary, you must write a big news article to criticize me
伊谢尔伦2017-04-17 17:18:30
The answer is yes, many simple demos for teaching are written like this, but it is generally not done in projects
天蓬老师2017-04-17 17:18:30
Handler is used for inter-thread communication, of course there is no problem between the main thread and the main thread
However, I personally feel that Handler is too manual, cumbersome, and has many restrictions to use. If you need to perform tasks in a new thread and publish them to the main thread, why not try AsyncTask or RxAndroid?
In addition, it is the main thread, why not call the method directly?
PHP中文网2017-04-17 17:18:30
It is definitely possible. It mainly depends on the demand. It is usually done in the main thread
PHP中文网2017-04-17 17:18:30
If Looper is not specified, it defaults to the main thread. If the processing is not time-consuming, it doesn't matter if it's all on the main thread.