I have a method in an object executing on a secondary thread. In the event that an error occurs, this method wants to tell the object’s delegate to respond to this. The response must take place on the main thread (i.e. UI thread).
How do I call through to the main thread from my secondary thread? My object’s class does not extend Activity, and I have no obvious Activity object at hand.
Use Android handler. Here’s an example
https://web.archive.org/web/20200810154212/http://www.tutorialforandroid.com/2009/01/using-handler-in-android.html
Of course, you will have to pass the Handler into your 2nd thread somehow.