private void executeOnLooper ( ControlRunnable runnable ) { if ( Thread . currentThread ( ) == realLooper . getThread ( ) ) { runnable . run ( ) ; } else { if ( realLooper . equals ( Looper . getMainLooper ( ) ) ) { throw new UnsupportedOperationException ( "main looper can only be controlled from main thread" ) ; } looperExecutor . execute ( runnable ) ; runnable . waitTillComplete ( ) ; } }
Executes the given runnable on the loopers thread and waits for it to complete .