Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Progress bars

Hey!

Has anyone incorporated the progress bar into their app? (ie, image downloads / loading pages / etc)

I've seen the example from the kitchen sink, but it just loops through a timer. I was wondering if anyone had, or knew of, an example that used the bar when actually downloading or loading something?

— asked May 11th 2010 by Will Collins
  • bar
  • progress
  • ui
0 Comments

6 Answers

  • I don't have an example yet. I'm having hard time to find some spare free time for coding :( but looking at the API i found this:

    The [HTTPClient] (https://developer.appcelerator.com/apidoc/mobile/1.2/Titanium.Network.HTTPClient-object.html) has "ondatastream". Use it together with the progressbar.

    Also, i wish more people will answer to the questions here.

    — answered May 11th 2010 by Catalin C.
    permalink
    0 Comments
  • The docs on the progress bar are not helpful for integrating the HTTPClient with progress bar. So, anyone who has an example on using HTTPClient.progress with progress bar PLEASE SHOW!

    My scripts gets rows from a server to put into a table, and since I know how many rows I'm getting I was able to make a progress bar within the onload event, but that's after the script has already received data from the server, so basically pointless, but maybe someone can use that idea.

    — answered March 22nd 2011 by Joe iEntry
    permalink
    0 Comments
  • I'm replacing my window title with a progressBar. Here's some code, shadow isn't supported yet, as far as I know, but I've kept the options in case it ever is:

    var progressBar = Ti.UI.createProgressBar({min: 0, max: 1, value: 0, message: "Fetching...", width: 200, color: "#fff", shadowColor: "#64696e", shadowOffset: {x:0, y:-1}, font: {fontSize: 14, fontWeight: "bold"}});
    if (iPad) {
        progressBar.color = "#64696e";
    }
    progressBar.style = Ti.UI.iPhone.ProgressBarStyle.BAR;
    progressBar.show();
    
    window.setTitleControl(progressBar);
    
    xhr.ondatastream = function(event) {
        if (event.progress > 0) {
            progressBar.message = "Fetching...";
            progressBar.value = event.progress;
        }
    };
    
    — answered September 7th 2011 by Staffan Living
    permalink
    0 Comments
  • I think this could work !!

    inline code

    
    
        var style = Ti.UI.ActivityIndicatorStyle.DARK;
        var activityIndicator = Ti.UI.createActivityIndicator({
          color: '#000',
          font: {fontFamily:'Helvetica Neue', fontSize:26, fontWeight:'bold'},
          message: 'Loading...',
          style:style,
          top:10,
          left:10,
          height:Ti.UI.SIZE,
          width:Ti.UI.SIZE
        });
    
           var sendit = Ti.Network.createHTTPClient({
                  ondatastream:function(e){
                 activityIndicator.show();
             },
                     timeout:1000, 
        });     
    
           sendit.onload = function(){             
             activityIndicator.hide();                                 
        };
    
    — answered April 19th 2013 by ilse ferman
    permalink
    0 Comments
  • Thanks for the answer Ravi; I do have that much down, but I guess what I am looking for is actually connecting it to something….as in, when a file is 50% downloaded, change the value from 0 to 50. I can't find any examples of this, even though the implementation–as you've linked– is available :(

    — answered May 11th 2010 by Will Collins
    permalink
    0 Comments
  • hi Jones

    check out this URL

    https://developer.appcelerator.com/apidoc/mobile/1.2/Titanium.UI.ProgressBar-object

    especially the Example at the bottom, guess that should solve your issue…

    — answered May 11th 2010 by Satta Ravi
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.