Code example for Handler

Methods: post

0
 
        // Execute onSuccess in the UI thread, but wait 
        // for it to complete. 
        // If it throws an exception, capture that exception 
        // and rethrow it later. 
        handler.post(new Runnable() {
            public void run() { 
                try { 
                    new Callable() {
                        @Override 
                        public Object call() throws Exception {
                            doOnPreCall(); 
                            return null; 
                        } 
                    }.call(); 
                } catch (Exception e) {
                    exceptions[0] = e;
                } finally { 
                    latch.countDown();
                } 
            }