每個函數中的「...」是什麼意思?爲什麼在最後一個函數中沒有「...」?「doInBackground(URL ... url)」中的三個點是什麼意思?
private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
protected Long doInBackground(URL... urls) {
int count = urls.length;
long totalSize = 0;
for (int i = 0; i < count; i++) {
totalSize += Downloader.downloadFile(urls[i]);
publishProgress((int) ((i/(float) count) * 100));
// Escape early if cancel() is called
if (isCancelled()) break;
}
return totalSize;
}
protected void onProgressUpdate(Integer... progress) {
setProgressPercent(progress[0]);
}
protected void onPostExecute(Long result) {
showDialog("Downloaded " + result + " bytes");
}
}
在這裏閱讀:http://stackoverflow.com/questions/3158730/java- 3-點-in參數 – star18bit