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.

inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Wait up-to getting full Web-service response

Hi,

I want the Javascript code which check the response getting from web-services,
so that I can wait to show the data after getting the full response.
Please help me if any one know the solution. 

Thanks & Regards,
Nitish Subudhi

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.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Wait up-to getting full Web-service response

All you need to do is using a XHR request to call the webservice I think. Have a closer look to this thread/post already discussed how to consume webservice informations: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Consume-a-xml-web-service-and-pa...


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Wait up-to getting full Web-service response

Thanks LBP for your Response.

I have One more doubt,
From getting data or loading files from SD Card it's taking very much time.
Is there any possible way to calculate how much time it is going to take!!!!

Help me Please. 

Thanks & Regards,
Nitish Subudhi

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.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Wait up-to getting full Web-service response

Yes, right, little bit here and we already had such questions here. I do not know how to speed things up or calculate the time it will take.

 

If you are working with bbUI.js you could use the Activity-Indicator until stuff is loaded. If you are working with images, this is really easy since they should have the onload functionality, so you could load images on after the other using the onload handler loading the next image then and on the last image you could remove the Activity-Indicator and show your content.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Wait up-to getting full Web-service response

Hi LBP,
Actually my problem is that,
When I am getting images from SD Card it executes but for loading it is taking time and after page transition some of the images are loading and remaining are showing blank.
So if I calculate the loading time or can check if it is loading then I can set the setTimeOut method or could find the solution regarding to this matter. 

Thanks & Regards,
Nitish Subudhi

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.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Wait up-to getting full Web-service response

That is why you could use something like the Activity-Indicator to be shown and if all the images loaded then you remove/hide the indicator and show the images.

 

Calculating loading time you will need to know all images and the time it will need for every image. Using the approach I gave with image.onload = function() {/*loadNextImage */} you can load image by image and after the last one is loaded you could show them and hide indicator. Try to write a asynchronous function to load each image, like from an array you store before and shift an image-reference (URI/path) from the array if it was loaded.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Wait up-to getting full Web-service response

Thanks for your Reply LBP,
But I am trying to show all images in Image Gallery in thumbnail.. And when I click any one image it should be show in slide view mode.
So I have to show all image at once in thumbnail. 

Thanks & Regards,
Nitish Subudhi

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.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Wait up-to getting full Web-service response

That is what I wanted to make clear. Show an activity-indicator and hide all image elements until they are loaded, then hide activity-indicator and show the full thumbnail gallery.

 

You could also use page-based thumbnail-gallery showing only x images per page that could fit the screens dimensions to speed things up on every page. Using left-to-right/right-to-left swipe you could navigate through all the thumbnail views.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Highlighted
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Wait up-to getting full Web-service response

Thanks LBP,
I am working for the gallery and trying to implement activity-indicator.
Hope this will work for me and solve my Problem. 

Thanks & Regards,
Nitish Subudhi

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.