Android Question StdViewPager question

Scott Heywood

Member
Licensed User
Longtime User
I'm using the sliding panels to display images. I'm using a different layout for each page that holds a new ImageView, with sometimes 20 different pages. Is there a way to use the same ImageView for each page and load the needed image when a new page is displayed? My app continues to crash and I feel like this is because I'm using too many ImageViews. When the activity with the StdViewPager is started all of the layouts along with the images are loaded together and the app crashes. The logs show: Downsampling image due to lack of memory.

Ultimately, I want to be able to swipe through the pages like flashcards, so if there is a better solution I'm open to suggestions. I'm not sure if the StdViewPager was intended for this type of use.

Thanks
 

Scott Heywood

Member
Licensed User
Longtime User
I am currently not using bitmaps to load the images. The images are loaded to the ImageView with the layout created with the designer, which seems to be sufficient at the moment. Would using LoadBitmapSample be more efficient? Is so, can you provide an example of how to use that method?

Also, I'll add that the issue appears to occur when using the back button and then navigating to the same activity. The images become fuzzy almost as if the activity is opened twice on top of itself. This eventually leads to the app crashing.
 
Last edited:
Upvote 0
Top