I'm not blocking the UI thread. In my test I stubbed out doDraw so it returns immediately and the behavior is the same. It's due to calling dismissDialog from the runnable.
On Nov 7, 11:51 am, Romain Guy <romain...@android.com> wrote: > It doesn't work because you are blocking the UI thread. You are not > "streaming" the UI at all like I suggested you do. You need to show the > dialog, then build the views by little batches so that you never block the > UI thread for more than a few milliseconds at a time. Otherwise your app > will appear frozen and might even get an ANR if the CPU is busy with another > task, > > > > On Sun, Nov 7, 2010 at 9:49 AM, Bret Foreman <bret.fore...@gmail.com> wrote: > > 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<android-developers%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Romain Guy > Android framework engineer > romain...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support. All such questions should be posted on public > forums, where I and others can see and answer them -- 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