I’m implementing a custom view where I use ViewFlipper which shows my custom View that consists of RelativeLayout parent and two children – ImageView and ProgressBar.
Initially I display thumbnail images in the ViewFlipper and when the particular child View is shown, I want to inintiate the full size image download for display. The problem is that in ViewFlipper I need to add all child View at the beginning (in onCreate of my Acticity). There are situations where my gallery consists of > 200 images and I do not want to initiate download of all the fullsize images because user may not navigate to all pages of the ViewFlipper at all. Is there a way to be notified in ViewFlipper that a particular view gets activated? I can hardly see it in this class.
Regards
I’m implementing a custom view where I use ViewFlipper which shows my custom View
Share
It seems that there is no callback to inform you that a view gets activated; you need to implement this yourself. It’s not hard: you need to subclass ViewFlipper and create a custom listener ViewFlipperListener with a method public void onViewFlip(ViewFlipper view, View newView).
Then override the ShowNext() and ShowPrevious() methods inherited from ViewAnimatior. In these methods, call their super counterparts and then call the listener’s onViewFlip callback passing in the new view (which you can get with getCurrentView()).
Hope this helps.