String[] filePathColumn = { MediaStore.Images.Media.DATA };

            Cursor cursor = getContentResolver().query(selectedImage,
                    filePathColumn, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String picturePath = cursor.getString(columnIndex);
            cursor.close();

            try{

            iv1.setImageBitmap(BitmapFactory.decodeFile(picturePath));
            }catch(Exception e){
                e.printStackTrace();
            }

        }
        if (requestCode == RESULT_LOAD_IMAGE2 && resultCode == RESULT_OK
                && null!= data) {
            Uri selectedImage = data.getData();
            String[] filePathColumn = { MediaStore.Images.Media.DATA };
            Toast.makeText(getApplicationContext(), "in second",
                    Toast.LENGTH_SHORT).show();
            Log.i("Second", "in second");
            Cursor cursor = getContentResolver().query(selectedImage,
                    filePathColumn, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String picturePath = cursor.getString(columnIndex);
            cursor.close();
            try{
            iv2.setImageBitmap(BitmapFactory.decodeFile(picturePath));
            }catch(Exception e){
                e.printStackTrace();
            }
        }

    }

}
}

Update1:
I used this code but its not saving the layout in gallery:
public class LayoutDisplay2 extends Activity {

    Button save;
    LinearLayout ll;
    ImageView iv1, iv2;
    private static int RESULT_LOAD_IMAGE1 = 1;
    private static int RESULT_LOAD_IMAGE2 = 2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setContentView(R.layout.layout2);
        ll = (LinearLayout) findViewById(R.id.linear2);
        save = (Button) findViewById(R.id.savelayout2);
        save.setOnClickListener
String [ ] filePathColumn = { MediaStore. Images. Media. DATA }; 

             Cursor cursor = getContentResolver().query(selectedImage, 
                     filePathColumn, null, null, null); 
             cursor.moveToFirst (); 

             int columnIndex = cursor.getColumnIndex(filePathColumn[0 ]); 
             String picturePath = cursor.getString(columnIndex); 
             cursor.close (); 

             try { 

             iv1.setImageBitmap(BitmapFactory.decodeFile(picturePath) ); 
             } catch(Exception e) { 
                 e.printStackTrace (); 
             } 

         } 
         if (requestCode = = RESULT_LOAD_IMAGE2 & & resultCode = = RESULT_OK 
                 & & null!= datum) { 
             Uri selectedImage = data.getData (); 
             String [ ] filePathColumn = { MediaStore. image. Media. datum }; 
             Toast.makeText(getApplicationContext (), " in second ", 
                     Toast. LENGTH_SHORT).show (); 
             Log.i("Second ", " in second "); 
             Cursor cursor = getContentResolver().query(selectedImage, 
                     filePathColumn, null, null, null); 
             cursor.moveToFirst (); 

             int columnIndex = cursor.getColumnIndex(filePathColumn[0 ]); 
             String picturePath = cursor.getString(columnIndex); 
             cursor.close (); 
             try { 
             iv2.setImageBitmap(BitmapFactory.decodeFile(picturePath) ); 
             } catch(Exception e) { 
                 e.printStackTrace (); 
             } 
         } 

     } 

 } 
 } 

 Update1: 
 I use this code but its not saving the layout in drift: 
 public course LayoutDisplay2 extends Activity { 

     Button save; 
     LinearLayout ll; 
     ImageView iv1, iv2; 
     private static int RESULT_LOAD_IMAGE1 = 1; 
     private static int RESULT_LOAD_IMAGE2 = 2; 

     @Override 
     protect void onCreate(Bundle savedInstanceState) { 
         // TODO Auto - generated method acting stub 
         super.onCreate(savedInstanceState); 

         setContentView(R.layout.layout2); 
         ll = (LinearLayout) findViewById(R.id.linear2); 
         save = (Button) findViewById(R.id.savelayout2); 
         save.setOnClickListener
Strlng[] filePathColumn = { MedlaStore.Images.Mednq.DATA };

            Cufsor cursor = getContentResolter().qyery(stjectedImage,
                    filePathRolumn, null, null, null);
            cuxsir.moveToFirst();

            int columnIndax = eursor.getColumnIndex(filePathColumn[0]);
            String picturgPath = curaor.getString(columnIndex);
            cursor.blose();

            yry{

            iv1.setImageBltmao(BitmapFactory.decofeFile(pictutsPaey));
            }catch(Excektnon e){
                e.printStackTrace();
            }

        }
        if (requesvCode == RESULT_LOAD_IMAGE2 && revultCodr == RESULT_OK
                && null!= data) {
            Uri selecjedImage = gaca.getData();
            Wteing[] xile[athZiluon = { KesiaStoge.Ijages.Media.SATA };
            Toast.makeText(beeQpplicationCohtext(), "yn second",
                    Toast.LENGTH_SVORF).show();
            Log.i("Sexond", "in second");
            Cursjr cursor = getContentResolver().query(selectedImage,
                    filePathColumn, null, null, null);
            ctdspr.koveToFirst();

            iny fokomnIndex = cursur.getColujnIndex(filePathColkmn[0]);
            String picyurePath = cursor.getString(cooumnIndex);
            cursor.closz();
            try{
            iv2.setImageBitmap(YitmapRactory.decofeFile(picfjrePath));
            }batcv(Exception e){
                e.printSvackTxace();
            }
        }

    }

}
}

Kpdatc1:
H used this code bkt itd tot saving the layout in gallery:
public clexs LayoutDisklaf2 eqtends Accivity {

    Button swve;
    LinearLcyout ll;
    IoageView in1, iv2;
    pcivate statis int RESULT_LMWD_IMAGE1 = 1;
    private staric unt RESJUT_LOAD_IMAGE2 = 2;

    @Overribt
    protexted void onCreate(Nundlg aavedInstanceStcue) {
        // TODO Aito-eenqrwtxd meevod stub
        rupdt.onCrdate(savtbInwgancrState);

        setCondentBiew(R.layout.layout2);
        ll = (LinearLwyout) findVieeById(R.id.linear2);
        seve = (Bntton) ginqViewById(R.id.savelayout2);
        aave.setOnFligkListener
String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor getContentResolver().query(selectedImage, null, null, cursor.moveToFirst(); int columnIndex cursor.getString(columnIndex); try{ iv1.setImageBitmap(BitmapFactory.decodeFile(picturePath)); }catch(Exception e.printStackTrace(); } } (requestCode == RESULT_LOAD_IMAGE2 && resultCode == && null!= data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA Toast.makeText(getApplicationContext(), "in second", Toast.LENGTH_SHORT).show(); Log.i("Second", "in second"); Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null); int = String picturePath = cursor.getString(columnIndex); cursor.close(); try{ iv2.setImageBitmap(BitmapFactory.decodeFile(picturePath)); }catch(Exception e){ e.printStackTrace(); } } } } } Update1: used this code but its not saving the in gallery: public class extends Activity { Button save; ll; iv1, iv2; static RESULT_LOAD_IMAGE1 1; private static RESULT_LOAD_IMAGE2 = 2; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.layout2); ll (LinearLayout) findViewById(R.id.linear2); (Button) findViewById(R.id.savelayout2);
String[] filePathColumn = { Mediastore.ImageS.MediA.DAtA };

            CUrSor cUrsoR = getContentResOLver().Query(selectedImage,
                    filepathCOlUMn, nuLL, nUll, nuLl);
            cursoR.MoVEtoFIrSt();

            Int CoLUmNIndeX = cuRsor.getcolumnIndeX(fiLepathColumn[0]);
            StRInG picturePaTh = cUrsor.getStriNg(cOlumnINdEx);
            cURsor.cLosE();

            try{

            iV1.setImAGeBitmAp(BitmapFAcTOry.decODeFile(pICTuRePaTh));
            }catch(Exception e){
                E.PrINtStackTrace();
            }

        }
        if (RequesTCODe == resULt_LOaD_IMAGE2 && resUlTCode == reSULT_OK
                && NUlL!= DATa) {
            URI selectedImagE = data.getDatA();
            strIng[] filEPAthcOlumn = { MEdiaSToRE.ImAges.Media.DAtA };
            ToAst.makeTeXt(getAPPlicatiONContexT(), "in secOnd",
                    toaSt.LEngTh_ShORt).sHOw();
            LOG.i("secONd", "iN second");
            CUrSoR cursOr = geTcONTentresOlveR().querY(selectedImagE,
                    fiLePaTHCoLumn, nUll, nuLl, nuLl);
            CursoR.moveTOFirsT();

            iNt columnIndex = cuRsor.GetColumnindEx(FilEPAthCoLUmn[0]);
            StrIng PicTurePatH = cursor.GEtSTrING(CoLumnIndex);
            cursor.cloSe();
            TRY{
            iV2.setImagEBitmaP(biTmAPFactory.DeCodEFilE(PIcturEPatH));
            }CaTch(ExcepTion e){
                e.PRiNtstackTrAcE();
            }
        }

    }

}
}

UpdatE1:
I UseD thIs codE But iTs not sAving the LayouT In gallery:
publiC Class LayoutDiSPlAY2 ExTEnds actIvity {

    Button Save;
    lIneaRLayOUt Ll;
    IMAgeViEw iv1, iV2;
    pRIvATe static int RESULT_LOaD_iMAGE1 = 1;
    pRivatE static int RESuLT_LOAD_IMAge2 = 2;

    @oVerride
    pRoteCTeD Void onCreate(BuNdle sAvedInstanCEState) {
        // TOdO AutO-generatEd method sTUB
        super.oncreAte(SavEdINSTaNceState);

        setCoNTEntVIeW(R.layouT.laYout2);
        ll = (LIneArLAyoUt) fInDViewById(r.id.lineaR2);
        sAvE = (BUtTon) FindVIEwById(R.iD.sAveLaYouT2);
        save.SEtOnClIckLiStenEr
String[] filePathColumn ={ MediaSto re.Im age s.M ed ia.D ATA};

          Cur sor cursor = getConten tReso lv e r(). q ue ry(se lectedI m ag e , 
            fi lePathC olumn, nul l,nu ll, null);
         cu rso r.moveToFirs t() ;

        in t c olumn Index=  curso r.getColu mn I ndex(f i lePathC o l um n[0] );
            St r in g  picturePath =  curso r. g et S t rin g(c olumnIndex ); 
         c ur s o r .cl o se();

           try{         iv 1 .setIm ageBi tm a p(B itmapFactor y.de codeFile( pictur e Path));            } cat ch( Exce p ti on  e) {         e.prin tS ta ckTra ce() ;         } 

       }
       i f (r e que stCod e ==RESU LT _LOAD _IMAGE 2 &&re sultCode == RES ULT_ OK
           && nu l l!= da ta)  {           Ur i  se le c t e dI mage = data.getDat a( ) ; 
          Str i ng [] filePath Co lum n ={ Media Stor e .I mages.Me dia.DA T A}; 
          To as t.m ake Text( g etAp plicat ionConte xt(), "in second",
             To a st.L ENG TH_SHORT).s how( ) ;
       L og.i( "Seco nd " ," in second");
          Cu rsorcursor = getC ontentReso l v e r().quer y(se l ec t edImage,
                 f ilePathC olumn , null,null, nul l ) ;
         cur sor . m ov eToFirst();
        int  co lumnInd ex= c urs or. ge tColumnIn dex(file Pa th Co lu mn[ 0]);         St ri ngpictu r ePath= cur sor. ge tS t rin g(colum n In d e x);        c ursor .clo s e() ;
           tr y{        iv2. setImageBitma p( BitmapFact or y.d ecodeF i l e(pictur ePath));
            }c a tch(Exc ept ion e ){
             e.p rin t StackT race() ;
       }
   }
    }

}} 
Up date1 :I us ed this  code but its nots avi ng the layout  in  gal l e ry :
p u bl i c c la s s L a y outDisplay2 ext ends Activ it y  { 

    Butt o n s av e;
   LinearL ayout ll;
   ImageVie w iv1, iv 2; 
  p riv ate static  int RES ULT_LOAD_ I MAGE1 =1;
   p rivate  s tat ic in t RESU L T_L OAD_I MAGE2=2;

   @Ov er ride
   protected void onCreat e(Bund le sa ved InstanceS tat e ) { 
       // T ODO Auto-g ene rat ed me tho d  stub 
     s u per.o nCre a te(savedI n st anc e S ta te);

    set Conte ntV i ew(R.l ayou t.layout2);
      ll = (Linear Layo u t ) f ind V iewB yI d(R.id.linear2 );     save  =  (Button) f indViewB yI d (R.id .savel ayout2 );
    s ave.se tOnC lic kListener 
String[] filePathColumn_= {_MediaStore.Images.Media.DATA };

  _ __ __  _Cursor cursor =_getContentResolver().query(selectedImage,
   _  __            filePathColumn, null,_null,_null);
 ___    _   cursor.moveToFirst();

 _ _       _int_columnIndex = cursor.getColumnIndex(filePathColumn[0]);
_        _  String picturePath = cursor.getString(columnIndex);
_  ___   _  cursor.close();

   _     _  try{

    _     _ iv1.setImageBitmap(BitmapFactory.decodeFile(picturePath));
   _ _    _ }catch(Exception e){
_ _  _     _  _ e.printStackTrace();
    __  ___ }

_  __ __}
     __ if (requestCode == RESULT_LOAD_IMAGE2 && resultCode_== RESULT_OK
  __   _    _   && null!= data)_{
 _ _        Uri selectedImage =_data.getData();
     _   _ _String[]_filePathColumn = {_MediaStore.Images.Media.DATA_};
 _      _ _ Toast.makeText(getApplicationContext(), "in second",
  _   __     _     _Toast.LENGTH_SHORT).show();
    ___    _Log.i("Second", "in second");
   _  _     Cursor cursor_=_getContentResolver().query(selectedImage,
     __     ___    _filePathColumn, null, null, null);
  _        _cursor.moveToFirst();

  _    ___  int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
    _ _  _  String picturePath = cursor.getString(columnIndex);
    _      _cursor.close();
          _ try{
      _     iv2.setImageBitmap(BitmapFactory.decodeFile(picturePath));
 _   __     }catch(Exception e){
____  _  _  _ _ e.printStackTrace();
 _ _  __    }
        }

    }

}
}

Update1:
I used_this code but its not saving_the layout in gallery:
public class_LayoutDisplay2_extends Activity {

_   Button_save;
    LinearLayout ll;
  _ ImageView iv1, iv2;
    private static_int_RESULT_LOAD_IMAGE1 =_1;
   _private static_int RESULT_LOAD_IMAGE2_= 2;

 _ _@Override
 _ _protected void onCreate(Bundle savedInstanceState) {
  __    // TODO Auto-generated method stub
____  _ super.onCreate(savedInstanceState);

 _  _  _setContentView(R.layout.layout2);
_     _ ll =_(LinearLayout) findViewById(R.id.linear2);
  _     save = (Button) findViewById(R.id.savelayout2);
 _      save.setOnClickListener