title: How to send multiple images to another activity in android?
body: <p>In my application i have created a custom camera where it captures images and save it in sd card. And also can view it in second activity. But it just replaces the previous images which i dont want. How to send multiple images to second activity?</p>
  
  <pre><code> @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.surfaceview);
          setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
          getWindow().setFormat(PixelFormat.UNKNOWN);
          surfaceView = (SurfaceView)findViewById(R.id.camerapreview);
          surfaceHolder = surfaceView.getHolder();
          surfaceHolder.addCallback(this);
          surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
          controlInflater = LayoutInflater.from(getBaseContext());
          View viewControl = controlInflater.inflate(R.layout.custom, null);
          LayoutParams layoutParamsControl = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
          this.addContentView(viewControl, layoutParamsControl);
          click = (Button) findViewById(R.id.button_capture);
          click.setOnClickListener(new OnClickListener(){
  
               public void onClick(View arg0) {
                     // TODO Auto-generated method stub
  
                     camera.takePicture(myShutterCallback,
                       myPictureCallback_RAW, myPictureCallback_JPG);
                    }});
                    }
  
                    ShutterCallback myShutterCallback = new ShutterCallback(){
  
                   @Override
                   public void onShutter() {
                    // TODO Auto-generated method stub
  
                   }};
  
                  PictureCallback myPictureCallback_RAW = new PictureCallback(){
  
                   @Override
                   public void onPictureTaken(byte[] arg0, Camera arg1) {
                    // TODO Auto-generated method stub
  
                   }};
  
                  PictureCallback myPictureCallback_JPG = new PictureCallback(){
  
                   @Override
                   public void onPictureTaken(byte[] arg0, Camera arg1) {
                    // TODO Auto-generated method stub
                    Bitmap bitmapPicture = BitmapFactory.decodeByteArray(arg0, 0, arg0.length);
  
  
                    filepath = Environment.getExternalStorageDirectory()+"/testing/"+"test.3gp";
                      System.out.println("thumbnail path~~~~~~"+filepath);
                      File file = new File(filepath);
                      Uri uriTarget = Uri.fromFile(file);
  
                    OutputStream imageFileOS;
                    try {
                     imageFileOS = getContentResolver().openOutputStream(uriTarget);
                     imageFileOS.write(arg0);
                     imageFileOS.flush();
                     imageFileOS.close();
                     Toast.makeText(CustomCameraActivity.this, "Image saved: " + uriTarget.toString(), Toast.LENGTH_LONG).show();
                     Intent returnIntent = new Intent();
                     returnIntent.putExtra("result",filepath.toString());
                     setResult(1,returnIntent);     
                     finish();
                    } catch (FileNotFoundException e) {
  
                     // TODO Auto-generated catch block
  
                     e.printStackTrace();
  
                    } catch (IOException e) {
  
                     // TODO Auto-generated catch block
  
                     e.printStackTrace();
  
                    }
                   // camera.startPreview();
  
                   }};
  
      @Override
      public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
          if(previewing){
              camera.stopPreview();
              previewing = false;
          }
  
          if (camera != null){
              try {
                  camera.setPreviewDisplay(surfaceHolder);
                  camera.startPreview();
                  previewing = true;
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      }
  
      @Override
      public void surfaceCreated(SurfaceHolder holder) {
          camera = Camera.open();
      }
  
      @Override
      public void surfaceDestroyed(SurfaceHolder holder) {
          camera.stopPreview();
          camera.release();
          camera = null;
          previewing = false;
      }
  
  }
  </code></pre>