Page 308 - MDP2020-1
P. 308

|    인천전자마이스터고등학교  ·············································································································
            302

            data)  {
                            super.onActivityResult(requestCode,  resultCode,  data);
                            if  (requestCode  ==  1)  {
                                    if  (resultCode  ==  RESULT_OK)  {

                                            try  {
                                                    InputStream             in                              =
            getContentResolver().openInputStream(data.getData());
                                                    Bitmap  img  =  new  BitmapFactory().decodeStream(in);

                                                    in.close();
                                                    imageView.setImageBitmap(img);
                                            }  catch  (FileNotFoundException  e)  {
                                                    e.printStackTrace();
                                            }  catch  (IOException  e)  {
                                                    e.printStackTrace();

                                            }
                                    }
                            }
                    }

            }
            (옷  데이터  클래스)
            package  com.example.smartstyler;


            import  android.os.Parcel;
            import  android.os.Parcelable;



            public  class  ClothesData  implements  Parcelable  {
                    String  name;
                    String  explaination;
                    int  imageViewId;



                    public  ClothesData(String  name,  String  explaination,  int  imageViewId){
                            this.name  =  name;
                            this.explaination  =  explaination;
                            this.imageViewId  =  imageViewId;

                    }


                    protected  ClothesData(Parcel  in)  {
                            name  =  in.readString();
                            explaination  =  in.readString();

                            imageViewId  =  in.readInt();
                    }
   303   304   305   306   307   308   309   310   311   312   313