I have an Activity that runs an AsyncTask on a TimerTask. While the task is being run, I show a ProgressDialog, and fire an intent to open another Activity when complete.
I would like to only show a ProgressDialog when this occurs, but if I leave out setContentView, my app still creates a small window display for the Activity. Is it possible to just show the ProgressDialog?
I could put the code from this Activity into the parent Activity that calls it but I want to be able to reuse this code, calling it from other Activities when needed.
I think that creating an Activity just for displaying a dialog isn’t the best approach. Dialog views are typically mean’t to be displayed on top of the current activity. If an Activity only contained a dialog and nothing else, then it would simply be a dialog window floating over an empty black background, which wouldn’t be the best design idea.
If you want a reusable dialog, I would suggest making a standalone class that wraps the dialog in question. Then instantiate that class from any of your Activities. That way you are using dialog’s properly as well as making it reusable.