Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sendBroadcast thru UI or non-UI thread?

Is it better (for performance) to send a broadcast (ACTION_APPWIDGET_UPDATE in my case), in a separate thread than the UI thread (a runnable)? Or is it acceptable practice to do so on the UI thread?

like image 435
Mehmet K Avatar asked Feb 11 '23 05:02

Mehmet K


1 Answers

You can read in documentation for sendBroadcast:

This call is asynchronous; it returns immediately, and you will continue executing while the receivers are run.

so it is perfectly safe to call it on UI thread

like image 182
marcinj Avatar answered Feb 15 '23 11:02

marcinj