It takes some time to draw my views so I want to put up a progress
dialog while I do it. I set up the code like this:
public class MyActivityClass {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.myView );
doBuild(savedInstanceState);
}
protected void doBuild( Bundle savedInstanceState ){
showDialog(drawingProgressDialogId);
ScreenBuilder builder = new ScreenBuilder();
builder.execute(savedInstanceState);
}
private class ScreenBuilder extends AsyncTask<Bundle , Integer ,
LinearLayout > {
@Override
protected LinearLayout doInBackground(Bundle... SIS) {
LinearLayout topLevelLayout = new
LinearLayout(MyActivityClass.this);
doDraw( SIS[0] , topLevelLayout ); // Adds a bunch of
child views
return topLevelLayout;
}
@Override
protected void onPostExecute(LinearLayout topLevelLayout) {
dismissDialog(drawingProgressDialogId);
setContentView(topLevelLayout);
super.onPostExecute(topLevelLayout);
}
}
}
This works the first time through, where savedInstanceState is null.
But when there is a configuration change, like rotation and
savedInstanceState is not null, the dismissDialog call does not work.
The progress dialog remains on the screen. This is true even if doDraw
is stubbed so that I'm not doing anything with the savedInstanceState.
Any ideas why this behavior might occur?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en