Ah ok, I thought you were using the URL for the filename (e.g. "http://someurl.com/<filename>") but you want to pass in the URL separate from the filename?
So there are two things that come to mind....
1) Just simply supply two String arguments into the method call, and just know that they should be URL and file name. Varargs will allow this...
In the task:
Code:
@Override
protected String doInBackground(String... args) {
// args[0] will be the URL
// args[1] will be the filename
}
Call it by:
Code:
new DownloadFile().execute("the url", "the filename");
2) If there will only be one URL (or one filename) per task, then have an instance variable in your task which stores the value and pass it to the constructor.
In the task:
Code:
private class DownloadFile extends AsyncTask<String, Integer, String> {
private final String url;
DownloadFile(final String url) {
this.url = url;
}
@Override
protected String doInBackground(String... args) {
// use this.url for the URL
// use args[0] for the filename
}
....
}
Call it by:
Code:
new DownloadFile("the url").execute("filename");
There are probably many other ways too...
Hopefully I've understood what you're after
Bookmarks