views:

44

answers:

1

I'm writing a customized view similar to Grid which will be used to hold a large amount of images. I'm using ImageButton to display the images, and I only want to load images onto the buttons once they are on the screen (and just display a static background image when they are not). The reason for it is that I'm fetching images from some back-end service and I only want to fetch them when the buttons are on the screen.

To do that, I'd like to know if the widget is on the screen. Is it possible to detect if a widget like button is on/off screen? If not, any suggestions on how to achieve what I'm trying to do?

+2  A: 

I don't think you can. The framework will just send you an onUpdate request when the widget is created, and then again according to your update policy.

I don't see why there would be a reason to change the image when the widget isn't being shown. You're not saving the OS any resources by doing so; it already knows not to draw your widget when it's off-screen.

Christopher
Thanks Christopher:) Sorry I didn't explain clearly in my question. I'm loading the images by calling services and I only want to make the service call once they are on the screen. (Just updated the question)
Rachel Z