public class DownloadFileTask
extends android.os.AsyncTask<java.lang.Void,java.lang.Integer,java.lang.Long>
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_REDIRECTS |
protected android.content.Context |
mContext |
protected java.io.File |
mDirectory |
protected java.lang.String |
mFilename |
protected DownloadFileListener |
mNotifier |
protected android.app.ProgressDialog |
mProgressDialog |
protected java.lang.String |
mUrlString |
Constructor and Description |
---|
DownloadFileTask(android.content.Context context,
java.lang.String urlString,
DownloadFileListener notifier) |
Modifier and Type | Method and Description |
---|---|
void |
attach(android.content.Context context) |
protected java.net.URLConnection |
createConnection(java.net.URL url,
int remainingRedirects)
Recursive method for resolving redirects.
|
void |
detach() |
protected java.lang.Long |
doInBackground(java.lang.Void... args) |
protected java.lang.String |
getURLString() |
protected void |
onPostExecute(java.lang.Long result) |
protected void |
onProgressUpdate(java.lang.Integer... args) |
protected void |
setConnectionProperties(java.net.HttpURLConnection connection) |
protected static final int MAX_REDIRECTS
protected android.content.Context mContext
protected DownloadFileListener mNotifier
protected java.lang.String mUrlString
protected java.lang.String mFilename
protected java.io.File mDirectory
protected android.app.ProgressDialog mProgressDialog
public DownloadFileTask(android.content.Context context, java.lang.String urlString, DownloadFileListener notifier)
public void attach(android.content.Context context)
public void detach()
protected java.lang.Long doInBackground(java.lang.Void... args)
doInBackground
in class android.os.AsyncTask<java.lang.Void,java.lang.Integer,java.lang.Long>
protected void setConnectionProperties(java.net.HttpURLConnection connection)
protected java.net.URLConnection createConnection(java.net.URL url, int remainingRedirects) throws java.io.IOException
url
- a URLremainingRedirects
- loop counterjava.io.IOException
- if connection failsprotected void onProgressUpdate(java.lang.Integer... args)
onProgressUpdate
in class android.os.AsyncTask<java.lang.Void,java.lang.Integer,java.lang.Long>
protected void onPostExecute(java.lang.Long result)
onPostExecute
in class android.os.AsyncTask<java.lang.Void,java.lang.Integer,java.lang.Long>
protected java.lang.String getURLString()