Optimizing paging between ImageViews in Android?
For the application I'm currently working on, I created something like
for multiple images (let's say an iPhone
with paging support).
I first hard-coded some
and loaded their resources on create / inflation, but after some tweaking (and there were improvements I thought), I reduced the required views to 3, of which 2 are
used to display the current page and animate the current and new pages.
With this change, I started using
to dynamically load a new image in my 2
before sliding through the pages (I am using PNG files which are sized for HVGA displays).
To my disappointment, performance has deteriorated, as much as possible lag when accelerating through the pages. A quick look in
showed that 17.4% of the total time when using the app 5x more than the following heavy method was consumed from
caused by my dynamically setting a resource to allocate.
I am thinking of ways to get around this and I want to do it in the best possible way, so any suggestions are greatly appreciated.
source to share