Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
avinash_kumar_ispg_in
Posts: 142
Registered: ‎01-02-2012
My Carrier: compny

how to detect the visible field on the screen

Hi 

  i have to display images on the screen by downloading it,so if images are more i need to download the images for the field which is visible on the screen.

 

 please any one give me the idea.

 

thanks

Please use plain text.
Developer
simon_hain
Posts: 13,754
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: how to detect the visible field on the screen

you can use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/ui/Field.html#isVisible() to check on every field if it is visible.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
avinash_kumar_ispg_in
Posts: 142
Registered: ‎01-02-2012
My Carrier: compny

Re: how to detect the visible field on the screen

Hi simon

 

Thanks for reply 

  please can you give me a code example how to use isvisible() method  to check visible field on the screen while scrolling up an down. actualy i am using it but every time it is showing false either by scroling field is visible or in visible.

 

thanks.

Please use plain text.
Developer
simon_hain
Posts: 13,754
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: how to detect the visible field on the screen

i don't have any code (that i would be allowed to post) where i use it
maybe you can post your code.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
avinash_kumar_ispg_in
Posts: 142
Registered: ‎01-02-2012
My Carrier: compny

Re: how to detect the visible field on the screen

i mean i am asking for a small example how to use it.

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Carrier: various

Re: how to detect the visible field on the screen

In fact, isVisible is not exactly the best method to use if you want to download the pictures when needed. You don't want to constantly check it - it would be better to be notified by the system when your Field becomes visible. Fortunately, you have onVisibilityChange method to tell you that. Override it the way you want - check the parameter and, if it's true, initiate the download.

 

You want to serialize the download requests, however - downloading more than one file simultaneously from the same location is pointless. You can use producer-consumer design pattern for the downloads and subscribe-publish to display the images once the download is finished. Your Fields will "produce" download requests which will be "consumed" and processed by a separate download thread. On the other hand, your Fields with "subscribe" to the "download complete" events which will be "published" by that thread.

 

Make a Google search on those design patterns and try coding everything on your own - it will be a tremendously useful exercise which cannot be replaced by simply copying any code people might post here. If you have specific problems doing that, show what you've done and what's not working and we will help.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Developer
avinash_kumar_ispg_in
Posts: 142
Registered: ‎01-02-2012
My Carrier: compny

Re: how to detect the visible field on the screen

Thanks arka

     for giving me the good suggestion sure I will try that and late you know 

 

thanks a lot.

Please use plain text.