Venu V
Venu V

Reputation: 73

Issue while showing large images in Android

We are now developing Android application which is working in both online and offline mode. The application has lot of large size of images, videos and pdf. So to work the application in off-line mode, we need to download all the images, video and pdf into the sd card. So in the offline mode, we are showing the image, video and pdf from the sd card.

Technical issue that we are facing in the application is that when user clicks on the images several times, out of memory issue occur. For resolving this, we have cleared the bitmap and garbage collection in the application, but for large images its showing out of memory issue. We are now getting the image resolution of 3502*1716 in the application. So we have recycled the image as 568*500 from the server and pass it through the web service to the application. In this condition, application works fine without any out of memory issue. But we required the image with 3502*1716 resolution in the application.

Please suggest some method to resolve this out of memory issue while clicking the images several times in the application.

Upvotes: 0

Views: 119

Answers (1)

Budius
Budius

Reputation: 39836

advice:

1) if you're using the view.widget.gallery don't! It's deprecated for a good reason, it's because it does not recycle the views. There're some customs ones online that implements the same behaviour but properly deals with view recycling.

2) You will not be able to use huge images the way you're planning like that. You'll likely have to implement something that resembles what the MapView does (load/unload smaller titles of the bigger picture). There might be some library for that, if you find the library make sure to post here for the community.

Upvotes: 1

Related Questions