Following Romain's suggestion, I changed the code above to look as
below. The interesting thing to note is that the behavior remains
exactly the same. The dialog gets dismissed when the activity is new
but won't dismiss when there is a configuration change. According to
my understanding, the runnable is running on the UI thread so the
thread-safety of the framework should not be an issue. Is this a
framework bug?

public class MyActivityClass {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView( R.layout.showtableview );
        doBuild(savedInstanceState);
    }

        Bundle SIS;

        protected void doBuild( Bundle savedInstanceState ){
                showDialog(drawingProgressDialogId);
                ScreenBuildRunnable sbRunnable = new ScreenBuildRunnable();
                Handler screenBuildHandler = new Handler();
                SIS = savedInstanceState;
                screenBuildHandler.postDelayed(sbRunnable, 100); // Wait 100 mS
for progress dialog to get drawn
        }

        private class ScreenBuildRunnable implements Runnable {

                @Override
                public void run() {
                    LinearLayout topLevelLayout = new
LinearLayout(SpreadsheetActivity.this);
                    doDraw( SIS , topLevelLayout );
                    dismissDialog( drawingProgressDialogId );
                    setContentView(topLevelLayout);
                }
        }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to