This is a general Java question and not an Android one first off!
I'd like to know how to run code on the main thread, from the context of a secondary thread. For example:
new Thread(new Runnable() {
        public void run() {
            //work out pi to 1,000 DP (takes a while!)
            //print the result on the main thread
        }
    }).start();
That sort of thing - I realise my example is a little poor since in Java you don't need to be in the main thread to print something out, and that Swing has an event queue also - but the generic situation where you might need to run say a Runnable on the main thread while in the context of a background thread.
EDIT: For comparison - here's how I'd do it in Objective-C:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0UL), ^{
    //do background thread stuff
    dispatch_async(dispatch_get_main_queue(), ^{
        //update UI
    });
});
Thanks in advance!
 
     
     
     
     
     
    