@SuppressLint("NewApi") private void attachImageFrommGallery(){
  Bundle conData=new Bundle();
  Intent intent=new Intent();
  if ((mSelectedGalleryItemsList.size() == 1) || (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2)) {
    intent.setData(mSelectedGalleryItemsList.get(0).mFileUri);
  }
 else   if (mSelectedGalleryItemsList.size() > 0) {
    ClipData.Item firstUri=new ClipData.Item(null,null,null,mSelectedGalleryItemsList.get(0).mFileUri);
    String[] mimeType={"*/*"};
    ClipData clipData=new ClipData("",mimeType,firstUri);
    for (int index=1; index < mSelectedGalleryItemsList.size(); index++) {
      ClipData.Item item=new ClipData.Item(null,null,null,mSelectedGalleryItemsList.get(index).mFileUri);
      clipData.addItem(item);
    }
    intent.setClipData(clipData);
  }
 else {
    Uri uriSavedFromLifeCycle=(Uri)mImagePreviewImageView.getTag();
    if (null != uriSavedFromLifeCycle) {
      intent.setData(uriSavedFromLifeCycle);
    }
  }
  intent.putExtras(conData);
  setResult(RESULT_OK,intent);
  VectorApp.setSavedCameraImagePreview(null);
  finish();
}

@ SuppressLint ( "NewApi" ) private void attachImageFrommGallery ( ) { Bundle conData = new Bundle ( ) ; Intent intent = new Intent ( ) ; if ( ( mSelectedGalleryItemsList . size ( ) == 1 ) || ( Build . VERSION . SDK_INT < Build . VERSION_CODES . JELLY_BEAN_MR2 ) ) { intent . setData ( mSelectedGalleryItemsList . get ( 0 ) . mFileUri ) ; } else if ( mSelectedGalleryItemsList . size ( ) > 0 ) { ClipData . Item firstUri = new ClipData . Item ( null , null , null , mSelectedGalleryItemsList . get ( 0 ) . mFileUri ) ; String [ ] mimeType = { "*/*" } ; ClipData clipData = new ClipData ( "" , mimeType , firstUri ) ; for ( int index = 1 ; index < mSelectedGalleryItemsList . size ( ) ; index ++ ) { ClipData . Item item = new ClipData . Item ( null , null , null , mSelectedGalleryItemsList . get ( index ) . mFileUri ) ; clipData . addItem ( item ) ; } intent . setClipData ( clipData ) ; } else { Uri uriSavedFromLifeCycle = ( Uri ) mImagePreviewImageView . getTag ( ) ; if ( null != uriSavedFromLifeCycle ) { intent . setData ( uriSavedFromLifeCycle ) ; } } intent . putExtras ( conData ) ; setResult ( RESULT_OK , intent ) ; VectorApp . setSavedCameraImagePreview ( null ) ; finish ( ) ; }
return the taken image from the gallery to the calling activity . this method returns to the calling activity .
