//这是带有参数(DownloadCallback)
的构造函数的类私有类DownloadTask扩展了AsyncTask {
private DownloadCallback<String> mCallback;
DownloadTask(DownloadCallback<String> callback) {
setCallback(callback);
}
void setCallback(DownloadCallback<String> callback) {
mCallback = callback;
}
//创建下载对象
* Start non-blocking execution of DownloadTask.
*/
public void startDownload() {
cancelDownload();
mDownloadTask = new DownloadTask();
mDownloadTask.execute(mUrlString);
}
正如我们所看到的,新对象的创建需要参数,但谷歌Android Documentations中的这段代码并不提供任何参数。我卡住了这一个错误 https://developer.android.com/training/basics/network-ops/connecting