The problem with the standard android gallery is that it will not use view recycling. You can do whatever you want cache images etc. The gallery itself will keep all imageviews that are added to the gallery in memory. This may lead to a fast scrolling gallery, but it also leads to a lot of out of memory exceptions.
A good solution for this is to use the Compatibility Library (available since Api Level 4) and the Viewpager that can be found in there. It will give you a very maintainable gallery that is much more usable (no more jumping of images etc.) and if you are using a FragemtSatePagerAdapter the fragments that are not currently shown in the gallery may be destroyed, if memory gets tight.
Be sure to implement the lifecycle of the fragments correct. This means:
- A fragment needs an empty constructor.
- Save the fragment data in onSaveInstanceState. In your case you may want to save the path to the image.
If you are not using fragments yet using the viewpager may look like a lot of work. But it is worth it. You and your user will have a much nicer app afterwards.