no activityIndicator on HTTPClient request
Is it possible to do a HTTPClient without showing the activityIndicator on the top of the screen on the iphone?
I want to do a httprequest which is not visible for the user. Not because it is a secret but because i want to use the activityIndicator for when the user needs to wait for the request, and not when the user can continue using the app with the request on the background.
2 Answers
-
Accepted Answer
Hi Derk,
1) To hide the activity indicator in the status bar, you could do this:
Titanium.UI.iPhone.hideStatusBar();
2) To display an activity indicator and prevent the user from clicking on other stuff like the tab bar, you could do something like this:
function showIndicator() { // window container indWin = Titanium.UI.createWindow({ fullscreen:true }); // black view var indView = Titanium.UI.createView({ height:150, width:150, backgroundColor:'#000', borderRadius:10, opacity:0.8 }); indWin.add(indView); // loading indicator actInd = Titanium.UI.createActivityIndicator({ style:Titanium.UI.iPhone.ActivityIndicatorStyle.BIG, height:30, width:30 }); indWin.add(actInd); // message var message = Titanium.UI.createLabel({ text:'Communicating with' + '\n' + 'the mothership...', color:'#fff', width:'auto', height:'auto', textAlign:'center', font:{fontFamily:'Helvetica Neue', fontSize:12,fontWeight:'bold'}, top:270 }); indWin.add(message); indWin.open(); actInd.show(); }; function hideIndicator() { actInd.hide(); indWin.close({opacity:0,duration:1000}); };
Regards,
Simon.
-
While I know that is possible from within the iPhone SDK, I haven't seen it within Titanium. It seems like they control that indicator for you.
Anyways, what you are requesting isn't standard iPhone practice. Typically the network indicator is just supposed to let the user know data is being transferred regardless of whether or not they can continue working. You would display a larger activity indicator and prevent them from doing things for whatever reason the app needs to wait. See the kitchen sink example for activity indicator for some of that implementation.