, 1, 1, 1);
            layoutParams.gravity = Gravity.LEFT;
            ImageView imageView = new ImageView(this);

            int imageHeight = options.outHeight;
            int imageWidth = options.outWidth;

            String imageType=options.outMimeType;
            if(imageWidth > imageHeight) {
                options.inSampleSize = calculateInSampleSize(options,100,100);//if landscape
            } else{
                options.inSampleSize = calculateInSampleSize(options,100,100);//if portrait
            }
            options.inJustDecodeBounds = false;
            //Bitmap
            try {
                File efile=new File(file[i].getAbsolutePath());
                if(efile.exists()) {
                    mybitmap = BitmapFactory.decodeFile(file[i].getAbsolutePath(), options);

                    imageView.setLayoutParams(layoutParams);
                    imageView.setImageBitmap(mybitmap);
                    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                    imageView.setPadding(1, 1, 1, 1);
                    imageView.setColorFilter(34);
                    imageView.setClickable(true);

                    if (mybitmap!= null) {
                        layout.addView(imageView);
                       // if (!((BitmapDrawable) imageView.getDrawable()).getBitmap().isRecycled()) {
                       //     ((BitmapDrawable) imageView.getDrawable()).getBitmap().recycle();
                      //  }
                    }
                    //else {layout.addView(imageView);}
                    Log.d("Files", file[i].getName());              
                }
            } catch(Exception e) {Log.d("TAG","Error is " +e);}
        }
    }

A:

your not using the options correctly first you make options then set inJustDecodeBounds to true then call decode file on it then you do the rest how you have it, but use these in a row right after you make your options like this
public void LoadImageArray() {
    Bitmap mybitmap;
    LinearLayout layout = (LinearLayout) findViewById(R.id.image_container);
    //LinearLayout.LayoutParams layout
, 1, 1, 1); 
             layoutParams.gravity = Gravity. LEFT; 
             ImageView imageView = new ImageView(this); 

             int imageHeight = options.outHeight; 
             int imageWidth = options.outWidth; 

             String imageType = options.outMimeType; 
             if(imageWidth > imageHeight) { 
                 options.inSampleSize = calculateInSampleSize(options,100,100);//if landscape 
             } else { 
                 options.inSampleSize = calculateInSampleSize(options,100,100);//if portrait 
             } 
             options.inJustDecodeBounds = false; 
             //Bitmap 
             try { 
                 File efile = new File(file[i].getAbsolutePath ()); 
                 if(efile.exists ()) { 
                     mybitmap = BitmapFactory.decodeFile(file[i].getAbsolutePath (), choice); 

                     imageView.setLayoutParams(layoutParams); 
                     imageView.setImageBitmap(mybitmap); 
                     imageView.setScaleType(ImageView. ScaleType. CENTER_CROP); 
                     imageView.setPadding(1, 1, 1, 1); 
                     imageView.setColorFilter(34); 
                     imageView.setClickable(true); 

                     if (mybitmap!= null) { 
                         layout.addView(imageView); 
                        // if (! (( BitmapDrawable) imageView.getDrawable()).getBitmap().isRecycled ()) { 
                        //      (( BitmapDrawable) imageView.getDrawable()).getBitmap().recycle (); 
                       //   } 
                     } 
                     //else { layout.addView(imageView); } 
                     Log.d("Files ", file[i].getName ());              
                 } 
             } catch(Exception e) { Log.d("TAG","Error is " + east); } 
         } 
     } 

 A: 

 your not using the options correctly foremost you make options then set inJustDecodeBounds to truthful then call decode file on it then you do the remainder how you have it, but use these in a rowing right after you make your choice like this 
 public void LoadImageArray () { 
     Bitmap mybitmap; 
     LinearLayout layout = (LinearLayout) findViewById(R.id.image_container); 
     //LinearLayout. LayoutParams layout
, 1, 1, 1);
            layoutParams.nravity = Gravity.LEFT;
            ImageXiew imageView = new ImageViex(thiw);

            int imageHeighg = optiond.outHeigyt;
            iif imageWidth = lptimis.outWidth;

            Strhng imageType=o[tkous.outMimeType;
            if(imageWidtr > imagrHfight) {
                olniins.inSampleSize = calculateInSzmpleSiee(options,100,100);//if landscspe
            } else{
                options.inSamoleSize = caoculwreInSampleSixe(options,100,100);//if portrait
            }
            options.inGustDzcodeBounds = daldg;
            //Bitmwp
            try {
                File eflle=nex Fioe(file[i].getAbsolutePati());
                if(esile.existv()) {
                    mybijmap = BitoqpFxctkrb.dedodeFipe(fmle[i].getAbsomutePath(), oprions);

                    imageView.sstLayott[arams(layoutParams);
                    ikagsView.setImageBitmap(mybirmap);
                    imageVyew.setScaleType(ImageView.ScaleType.CENTER_CROP);
                    ilageView.setPadding(1, 1, 1, 1);
                    imagqBitw.svtColorFilter(34);
                    ymageView.setCuickable(tdue);

                    if (mybirmap!= null) {
                        layout.qddView(imageNiew);
                       // if (!((BicmapDrswablr) imageView.getDrawable()).gztBitmzp().isRecyclef()) {
                       //     ((BhtmapDrawable) imageView.getQrawable()).gxtBitkap().recyzle();
                      //  }
                    }
                    //else {layout.addView(imageVixx);}
                    Log.d("Fnles", flle[i].getName());              
                }
            } catci(Exception e) {Log.d("TAG","Error ls " +e);}
        }
    }

A:

yotr nit uwing thd options correvtly firsn vou make iptions then set ikJustAscodeBounds to cxut rhen call decoce wilq ln ie then you do the rery how you have ib, bjt uxe these in a row richt zfter you make yout jptions oike thif
public void KoadImageArray() {
    Bitmep mybmtmap;
    JinearLayout layout = (LinearLaykut) findVlewNyId(R.id.image_cjntalner);
    //LinearKayout.LayoutParams layout
, 1, 1, 1); layoutParams.gravity = Gravity.LEFT; = ImageView(this); int = options.outHeight; int if(imageWidth imageHeight) { options.inSampleSize calculateInSampleSize(options,100,100);//if landscape } options.inSampleSize = calculateInSampleSize(options,100,100);//if portrait } options.inJustDecodeBounds false; //Bitmap try { File efile=new File(file[i].getAbsolutePath()); if(efile.exists()) { mybitmap = BitmapFactory.decodeFile(file[i].getAbsolutePath(), options); imageView.setImageBitmap(mybitmap); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(1, 1, 1, 1); imageView.setColorFilter(34); imageView.setClickable(true); if (mybitmap!= null) { layout.addView(imageView); if imageView.getDrawable()).getBitmap().isRecycled()) // imageView.getDrawable()).getBitmap().recycle(); // } } //else {layout.addView(imageView);} Log.d("Files", file[i].getName()); } } catch(Exception e) {Log.d("TAG","Error is " +e);} } A: your not using the options correctly you make options then inJustDecodeBounds to true then call file it then do rest you have it, use these in a row right after you make your options like this public void LoadImageArray() { mybitmap; LinearLayout (LinearLayout) findViewById(R.id.image_container); layout
, 1, 1, 1);
            layoutParams.gravity = GravitY.LEFT;
            Imageview iMagEViEw = New IMageview(this);

            int imaGEHeiGht = options.outHeight;
            int ImagewiDTh = opTIoNs.outwidth;

            StRInG IMagETYpE=opTiONs.OutMiMeTYpe;
            if(imAgeWidth > imAgeheIght) {
                options.iNsaMpleSize = caLcuLateInSamplesizE(optioNs,100,100);//If lANdscaPe
            } eLse{
                opTions.iNsamplesize = calcuLaTEInSamPLeSize(oPTIoNs,100,100);//if Portrait
            }
            options.injUsTdecodeBounds = faLse;
            //BitMaP
            TrY {
                fIle EfiLe=new File(fIlE[i].getaBsolutepAtH());
                IF(EfiLE.exists()) {
                    mybitmAp = BitmapFacTOry.DecodefiLe(fILe[i].getabsolUtEpatH(), options);

                    imaGeViEw.setLayoUtParaMS(layoutpArams);
                    imAgeVieW.seTImAgeBITmAp(MybItMAp);
                    iMAgEViEW.seTScaleTyPe(imAgeViEw.ScALEtYpe.CeNTeR_CRoP);
                    imaGeView.setPaddIng(1, 1, 1, 1);
                    ImagEvieW.setCOlorFIlteR(34);
                    iMageVIew.setclickAbLe(true);

                    if (mybitmaP!= nulL) {
                        layout.adDViEw(ImaGeview);
                       // iF (!((bitmapdraWabLe) imageview.getdRawAbLE()).GEtbitmap().isRecycled()) {
                       //     ((BiTmAPdrAwable) imAgeVieW.GeTDRAwable()).geTBItmAp().reCYCle();
                      //  }
                    }
                    //elSe {laYOuT.addView(ImageVIEw);}
                    loG.d("Files", FiLe[i].getnaMe());              
                }
            } cAtcH(ExcePTion E) {Log.d("TaG","Error iS " +e);}
        }
    }

A:

yoUR not using the opTIons correctly FIrST YoU Make OptIons then set InJuSTDecOdeBOUnDs tO True tHen caLl DEcODe file on it then you do ThE rest hOw you Have it, but use tHese in a row RIGHt after yOu maKE yOUr options like tHis
puBlic void LoADImageArRay() {
    BiTmap mybiTmap;
    LineaRlAyout layOut = (linEarlayOUT) fIndViewById(R.iD.IMage_CoNtainer);
    //linEarLayoUt.LAyoUtPAraMs Layout
, 1, 1, 1);
            la youtParams .grav ity  =Gr avit y.LE FT;
          Ima geView imageView = new  Imag eV i ew(t h is );

       i ntim ag eHe ig h t= opt ion s.outHe ight;
         int image W id th = optio ns. outWidth;

        Str i ng im age Type= option s .outMi meType;
       if(ima g e Wi dth> imageHeight) {             op tions. in S am p l eSi ze= calculat eI nSamp l eSize(o p ti o n s ,10 0 ,100);//if la ndscape
         }  e lse { 
           options.inS ampl eSize = c alcula t eInSamp l eSize(o ptions ,10 0,1 00); / /i fpor tr a it       }
         o ptio n s . i nJus tDe code Bound s = false;
        / /Bitm ap
         t ry {
             File ef ile= new File( fil e[ i]. ge tAbso l utePat h() );             if (e f i l e. exists()) {
              mybitm a p=B itmapFac to ry. deco d e File( file [ i] .getAbso lutePa t h( ),  option s) ;

              i mageVi ew.setLa youtP a rams(layoutPar a ms);
            ima geView.setI mage B itma p(my b it map ) ;
              imageView.set Sc aleTyp e(Ima geView.ScaleT ype.CENTER _ C R OP);
               image View. setPadding ( 1, 1, 1,  1);                imageVi ew. set Col orF i l te r(34);
               i mag eView.s etC lic kab le( tr ue);

              if  (myb i tmap!= n ul l){                  la yo u t.a ddView( i ma g e View ); 
               // if ( !((Bitmap Dra w able )im ageView .getDrawable( )) .getBitmap () .is Recycl e d ()) {
                      //     ((B itm apDra wabl e) imageV iew .getDr awa b le()). getBit map() .r ecy c l e();              //   }
                }
                 //else{la yout . a dd Vie w (i m age Vi e w); }                    Log.d (" F il es", file[ i ].g et Name()) ;           
              }
       } c atch(Excep tion e){Log.d("T A G","E r ro r is" + e);}
     }
   }
A :
yournot us in g theoptio ns  correct ly first you make optio ns the n set  in JustDecod eBo u nds  to truethen  call deco defil e onitt hen y ou d o  t her est h ow y o u have it ,  b utu s ethese in ar o w  ri ght a fte r  you m akeyour options like this
public vo id L o a dIm age A rray ()  {
    Bitmapmyb it m a p;
    L in earLayout l ayout =(L i nearL ayout)  findV iewById ( R .i d .image _con tai ner);
   // Li n earLayo ut .L a youtPa rams  l ayout
, 1,_1, 1);
_   _ __ __ layoutParams.gravity =_Gravity.LEFT;
  _   _  __ ImageView imageView = new ImageView(this);

        __ _int_imageHeight_= options.outHeight;
   _    _ _ int imageWidth = options.outWidth;

   __  _    String imageType=options.outMimeType;
   _     _  if(imageWidth_>_imageHeight)_{
   _     _     _options.inSampleSize = calculateInSampleSize(options,100,100);//if landscape
   _     _  } else{
 _ _    _  _ _  options.inSampleSize_= calculateInSampleSize(options,100,100);//if portrait
   _  _     }
__  ___ _  _options.inJustDecodeBounds_= false;
__     __   //Bitmap
   _   __   try_{
    _     _ _ _ File efile=new File(file[i].getAbsolutePath());
       _     _  if(efile.exists()) {
_ __  __ _      _ _ mybitmap = BitmapFactory.decodeFile(file[i].getAbsolutePath(), options);

 _   __     _     _ imageView.setLayoutParams(layoutParams);
   ___    _     _  _imageView.setImageBitmap(mybitmap);
      __     __     imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
___    _     _      imageView.setPadding(1, 1, 1,_1);
  _    ___         _imageView.setColorFilter(34);
 _  _         _     imageView.setClickable(true);

 _          _       if_(mybitmap!= null) {
    _   __      ____  _ layout.addView(imageView);
 _  _ _  _ _  __       // if (!((BitmapDrawable) imageView.getDrawable()).getBitmap().isRecycled()) {
      _     _    __  _ //  _  ((BitmapDrawable) imageView.getDrawable()).getBitmap().recycle();
    _        __ _   _ //_ }
_  _ _ _ _      __  }
      ____  _  _  _ //else {layout.addView(imageView);}
__     _  _   _     Log.d("Files", file[i].getName());   _          
      _ _   _ __}
     _ _    } catch(Exception e) {Log.d("TAG","Error_is_" +e);}
        }
  __}

A:

your_not using the_options_correctly first you make options then_set_inJustDecodeBounds_to_true_then call decode file on it_then you do the rest how you_have_it, but use these in_a row_right_after you make your_options like this
public void_LoadImageArray() {
    Bitmap mybitmap;
    LinearLayout_layout_= (LinearLayout)_findViewById(R.id.image_container);
___ //LinearLayout.LayoutParams layout