protected void setProgressMessage ( final String message ) { runOnUiThread ( new Runnable ( ) { public void run ( ) { synchronized ( lockProgress ) { if ( progressDialog != null ) { // a dialog is already open, change the message progressDialog . setMessage ( message ) ; return ; } progressDialog = new ProgressDialog ( VideoDisplayActivity . this ) ; progressDialog . setMessage ( message ) ; progressDialog . setIndeterminate ( true ) ; progressDialog . setProgressStyle ( ProgressDialog . STYLE_SPINNER ) ; } // don't show the dialog until 1 second has passed long showTime = System . currentTimeMillis ( ) + 1000 ; while ( showTime > System . currentTimeMillis ( ) ) { Thread . yield ( ) ; } // if it hasn't been dismissed, show the dialog synchronized ( lockProgress ) { if ( progressDialog != null ) progressDialog . show ( ) ; } } } ) ; // block until the GUI thread has been called while ( progressDialog == null ) { Thread . yield ( ) ; } }
Displays an indeterminate progress dialog . If the dialog is already open this will change the message being displayed . Function blocks until the dialog has been declared .