Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17031] BlackBerry: ProgressBar causes crash on start

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-06-16T21:14:23.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsBlackBerry
Labelsprogressbar, qe-3.3.0, qe-testadded
ReporterOlga Romero
AssigneePedro Enrique
Created2014-05-27T20:18:48.000+0000
Updated2014-06-16T21:14:23.000+0000

Description

When testing progress bar functionality, using the below code
var win = Ti.UI.createWindow({
	layout:'vertical'
});
	var value = 0;
	var ind, button, interval,lbl1,lbl2;
	
	
	    button = Titanium.UI.createButton({
			title : 'Start Progress',
			height : Ti.UI.SIZE,
			width : 200,
			top : 20
		});
		ind = Titanium.UI.createProgressBar({
			width : Ti.UI.SIZE,
			min : 0,
			max : 10,
			top: 50,
			value : 0,
			height : Ti.UI.SIZE,
			color : '#888',
			//message : 'Downloading 0 of 10',
			//font : {fontSize : 14}
			//fontWeight : 'bold'
		
		});
		
		//
		// BUTTON LISTENER TO KICK OFF PROGRESS BARS
		//
		button.addEventListener('click', function() {
			ind.show();
			val = 0;
			if (interval) {
				clearInterval(interval);
			}
			interval = setInterval(function() {
				
				lbl2 = Ti.UI.createLabel({
		        text:'INTERVAL FIRED value ' + val,
		        color:'red',
		        top: 5,
		        width:Ti.UI.SIZE,
		        Height:Ti.UI.SIZE,
		        textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
		        font:{fontSize:8}
			    });
			 
			 win.add(lbl2);
			 
				Ti.API.info('INTERVAL FIRED value ' + val);
				if (val >= 10) {
					clearInterval(interval);
				
				lbl1 = Ti.UI.createLabel({
		        text:'Progress Complete',
		        color:'red',
		        top: 20,
		        width:Ti.UI.SIZE,
		        Height:Ti.UI.SIZE,
		        textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
		        font:{fontSize:12}
			    });
			 
			 win.add(lbl1);
			 
				};
				ind.value = val;
				//ind.message = 'Downloading ' + val + ' of 10';
				val++;

			}, 1000);
		});
		
		
		
win.add(button);
win.add(ind);
		
win.open();
	
the app crashes after click event
[INFO] INTERVAL FIRED value 0

Steps

1. In Studio create the app and replace app.js with above code 2. Build for BB device 3. Start progress bar

Expected

[INFO] :   INTERVAL FIRED value 0
[INFO] :   INTERVAL FIRED value 1
[INFO] :   INTERVAL FIRED value 2
[INFO] :   INTERVAL FIRED value 3
[INFO] :   INTERVAL FIRED value 4
[INFO] :   INTERVAL FIRED value 5
[INFO] :   INTERVAL FIRED value 6
[INFO] :   INTERVAL FIRED value 7
[INFO] :   INTERVAL FIRED value 8
[INFO] :   INTERVAL FIRED value 9
[INFO] :   INTERVAL FIRED value 10

Attachments

FileDateSize
expected.png2014-05-27T20:30:09.000+000050479
log.txt2014-05-27T20:18:48.000+000013141

Comments

  1. Pedro Enrique 2014-05-29

    Resolving as invalid. The JavaScript test is wrong and the code is bad, bad in syntax, structure, and API usage. Use this code instead:
       var win = Ti.UI.createWindow({
       	layout:'vertical'
       });
       var value = 0;
       var ind, button, interval,lbl1,lbl2;
       
       
       button = Titanium.UI.createButton({
       	title : 'Start Progress',
       	height : Ti.UI.SIZE,
       	width : 200,
       	top : 20
       });
       ind = Titanium.UI.createProgressBar({
       	left : 20, right: 20,
       	min : 0,
       	max : 10,
       	top: 50,
       	value : 0,
       	height : Ti.UI.SIZE,
       	color : '#888',
       	//message : 'Downloading 0 of 10',
       	//font : {fontSize : 14}
       	//fontWeight : 'bold'
       
       });
       
       //
       // BUTTON LISTENER TO KICK OFF PROGRESS BARS
       //
       lbl2 = Ti.UI.createLabel({
           color:'red',
           top: 5,
           width:Ti.UI.SIZE,
           Height:Ti.UI.SIZE,
           textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
           font:{fontSize:8}
       });
       win.add(lbl2);
       
       lbl1 = Ti.UI.createLabel({
           text:'Progress Complete',
           color:'red',
           top: 20,
           width:Ti.UI.SIZE,
           Height:Ti.UI.SIZE,
           textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
           font:{fontSize:12}
       });
       		 
       win.add(lbl1);
       	 
       
       button.addEventListener('click', function() {
       	ind.show();
       	val = 0;
       	if (interval) {
       		clearInterval(interval);
       	}
       	interval = setInterval(function() {
       		
       		lbl2.text = 'INTERVAL FIRED value ' + val;
       	 
       		Ti.API.info('INTERVAL FIRED value ' + val);
       		if (val >= 10) {
       			clearInterval(interval);
       			lbl1.text = 'Progress Complete';
       		};
       		ind.value = val;
       		//ind.message = 'Downloading ' + val + ' of 10';
       		val++;
       
       	}, 1000);
       });		
       		
       win.add(button);
       win.add(ind);
       		
       win.open();
       
  2. Olga Romero 2014-06-16

    Mac osx 10.9.3 Mavericks Appcelerator Studio, build: 3.3.0.201406111952 Titanium SDK, build: 3.3.0.v20140613161751 Node.JS Version: v0.10.13 NPM Version: 1.3.2 acs@1.0.14 alloy@1.4.0-rc npm@1.3.2 titanium@3.3.0-rc titanium-code-processor@1.1.1 Device: BB Z10 (10.2.1) Verified as fixed.

JSON Source