You are attempting to allocate too much memory for image data. As you explained in the comments, your images are fairly large and they are being read as soon as the adapter is created.
Reading this into memory will consume 4 bytes per pixel, so if your images are 1024 pixels square, the math is:
- 1024 × 1024 × 4 = 4MB
- 15 images × 4 MB/image = 60MB
This likely exceeds the heap budget of 48MB.
You will likely want to improve the efficiency through which you display these images. Consider:
- Only loading the image when it is shown, using GridView's mechanisms for
getView();
- Loading bitmaps with a sample size using BitmapFactory.