Raghu Kaligipula
Raghu Kaligipula

Reputation: 404

How can i send mulltiple images at once to server?

i need to send three images at once to server, currently i can send one image by following code(PictureId). If i need to send three images say Picture1Id, Picture2Id, Picture3Id how can set in (protected 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 ///////////

Upvotes: 0

Views: 48

Answers (1)

user3137768
user3137768

Reputation:

Start multiple Thread instances of the 'upload thread' with separate files to be uploaded.
Purely upon java concept, You can write a Thread class that uploads a file. And initiate many instances(as much as the files) and start them all together.

Upvotes: 1

Related Questions