The accepted answer was very helpful, but it doesn't have a progress dialog.
Fortunately for you, reader, I have created an extremely comprehensive and working example of an AsyncTask with a progress dialog!
- Rotation works, and the dialog survives.
- You can cancel the task and dialog by pressing the back button (if you want this behaviour).
- It uses fragments.
- The layout of the fragment underneath the activity changes properly when the device rotates.