Search code examples
androidmultithreadingrunnableandroid-runonuithread

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?


Solution

  • 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