Neal
Neal

Reputation: 9649

Showing a progress dialog while creating view for android activity

In an android activity I have a lenghty process in building a report (view). I would like to show a progress dialog "Building Report..Please Wait" while the view is being created. Is it possible to start and activity (screen switch) and then show a progress dialog and then present the view?

I guess alternatively I could build the view on a background thread from the main activity while showing a progress dialog and then once the view is created I could start the next activity and present the built view.

What is the best way to handle something like this, i.e. show feedback while a complex view is being built? The view has to be built in code, not XML, and with the iterations of the data it can be a few seconds. I want the application to appear responsive.

Thank you.

Upvotes: 3

Views: 1665

Answers (1)

Neal
Neal

Reputation: 9649

I figured this out. I show the progress dialog and then start a background task which has the setcontentView in the RunOnUiThread element and hide the progress dialog.

Upvotes: 1

Related Questions