編譯器錯誤是「The method execute(ArrayList<String>...) in the type AsyncTask<ArrayList<String>,Void,ArrayList<String>> is not applicable for the arguments (String)
」我無法通過一個字符串數組來我的AsyncTask
爲什麼不是接受新的參數?任何人都可以看到我做錯了什麼?
ArrayList<String> passing = new ArrayList<String>();
passing.add(logicalUrl);
passing.add("filename.pdf");
new myTask().execute(logicalUrl);
return true;
}
public class myTask extends AsyncTask<ArrayList<String>, Void, ArrayList<String>> {
ProgressDialog dialog;
@Override
protected void onPreExecute() {
dialog = new ProgressDialog(ModuleContents.this);
dialog.setTitle("Downloading...");
dialog.setMessage("Please wait...");
dialog.setIndeterminate(true);
dialog.show();
}
protected ArrayList<String> doInBackground(ArrayList<String>... passing) {
ArrayList<String> passed = passing[0];
String physicalUrl = parsePhysicalUrl(passed.get(0));
String filename = passed.get(1);
try {
globals.saveFile(physicalUrl, filename);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return passed;
}