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?
Handler is mainly used for asynchronous message processing.
If it is all on the main thread, I personally think it is not necessary
This is definitely possible, but whether it is necessary depends on personal habits.
It can all be in the main thread. It can be used when doing some linkage. It may also be used when customizing controls
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
The answer is yes, many simple demos for teaching are written like this, but it is generally not done in projects
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?
If you need to control the rhythm of UI updates, you can use this logic
This is for sure
Is it necessary to look at your specific needs?
It is definitely possible. It mainly depends on the demand. It is usually done in the main thread
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.