android Image view out of memory error

后端 未结 5 1630
一整个雨季
一整个雨季 2021-01-25 06:43

In my Android project I have imageButton , and after clicking on it , it must open new Activity with imageView , and in my new Activity I must see the ImageButton\'s image only

5条回答
  •  广开言路
    2021-01-25 07:22

    in your code start at if(null != path) change to this

    int size = 10; //minimize  as much as you want
    if(path != null){
         Bitmap bitmapOriginal = BitmapFactory.decodeFile(pathath);
         Bitmap bitmapsimplesize = Bitmap.createScaledBitmap(bitmapOriginal,bitmapOriginal.getWidth() / size, bitmapOriginal.getHeight() / size, true);
         bitmapOriginal.recycle();
         img1.setImageBitmap(bitmapsimplesize);
    
    }
    

提交回复
热议问题