When I use my code in one class file, it runs perfectly:
package com.example.downloadfile;
import java.io.File;
import java.io.FileOutputStream;
import java
If you can somehow pass the Activity class or its context to the AsyncTask that will solve your issue for showing dialog. You would need to include another parameter together with the URL you are sending and put that parameter in a Context variable. And then whenever you need the dialog you use that context variable to show it.
If the dialog does not have a Context from which to show it will definitely run into runtime errors.
Update (put my comment up here as well): here we go... found a good example that you can modify to make use for your case. It's at brighthub.com/mobile/google-android/articles/82805.aspx. Scroll down to Source Code section and have a look at the code for WebServiceAsyncTask and WebServiceBackgroundActivity.