我需要一次向服务器发送三个图像,目前我可以通过以下代码发送一个图像(PictureId)。如果我需要发送三个图像说Picture1Id,Picture2Id,Picture3Id如何设置(保护Void doInBackground(Void ... params){})
// IMAGE UPLOAD ///////////
final ProgressDialog progress = new ProgressDialog(NBCompetitorTracking_Activity.this);
progress.setMessage("Uploading image, please wait...");
// If auto upload true upload picture:
if (new SessionManager(NBCompetitorTracking_Activity.this).isAutoUpload()) {
// upload image
new AsyncTask<Void, Void, Void>() {
@Override
protected void onPreExecute() {
super.onPreExecute();
progress.show();
}
@Override
protected Void doInBackground(Void... params) {
UploadImage.uploadImage(NB_CompetitorTracking.**PictureId**);
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
progress.dismiss();
}
};
}
// END: IMAGE UPLOAD ///////////
答案 0 :(得分:1)
使用要上传的单独文件启动“上传线程”的多个线程实例。实际上,在java概念上,您可以编写一个上传文件的Thread类。并启动许多实例(与文件一样多)并一起启动它们。