Do callbacks occur on the main (UI) thread?
<p>There are a lot of Android SDK APIs where callback handlers are registered.  For a concrete example, with MediaPlayer you can set an onCompletionListener callback.  Will these callbacks be called from the main (UI) thread?  If the answer is "it depends", then I'm looking for some general rules for what callbacks will be called from the main thread versus another thread.  The SDK documentation doesn't seem to spell it out.  (Maybe I missed it.)</p>

<p>It seems important to know, because if I'm guaranteed main thread callbacks, then I can skip some thread synchronization on data shared between different places in code.  If I'm forced to be pessimistic out of ignorance, then I have to write extra synch block code and worry about deadlocks, data integrity, and reduced performance.</p>
