title: How to do an image compression
body: <p>i am creating an android app where in i am getting all the images from the gallery to display in a grid view in my activity.
  I am also displaying checkboxes along with the images so the user can select multiple images and upload it to the server.
  to upload it to the server i am using</p>
  
  <p><a href="http://pastie.org/7982713" rel="nofollow"><strong>UploadToServer.class</strong></a> </p>
  
  <p>and the calling function to this class is</p>
  
  <pre><code>UploadToServer upload=new UploadToServer();
  public void uploadImage(View v){
  
       progressDialog = ProgressDialog.show(MultiPhotoSelectActivity.this, "", "Uploading files to server.....", false);
       Thread thread=new Thread(new Runnable(){
          public void run(){
              for( int i=0;i&lt;selectedItems.size();i++)
              {
                  doFileUpload(selectedItems.get(i));
                  runOnUiThread(new Runnable(){
                      public void run() {
                          if(progressDialog.isShowing())
                              progressDialog.dismiss();
                      }
                  });
             }
          }
  });
  
  thread.start();
  
  }
  private void doFileUpload(String imagepath) {
      // TODO Auto-generated method stub
  
      try{
              upload.uploadFile(imagepath);
  
      }
      catch(Exception e){
  
          Log.e("log_tag", "Error in http connection "+e.toString());
  
          }
  }
  </code></pre>
  
  <p>I want to put a compression code for the images as the user is gonna select multiple images...can somebody please suggest what compression code to use and where should i put it??? i m very new to android app development and i hav never used any image compression code before..
  Please suggest where can i put a compression code for images in my app???</p>
  
  <p>Please help!</p>
  
  <p>Thanks in advance!</p>