Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15807] Android: Label value does not change in response to slider

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionDuplicate
Resolution Date2013-11-26T23:04:31.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsqe-3.2.0, regression
ReporterPragya Rastogi
AssigneeHieu Pham
Created2013-11-25T06:52:48.000+0000
Updated2014-05-30T20:47:08.000+0000

Description

Label value does not change when sliding through slider. This could be a regression issue as in SDK:3.1.3.GA Value of label changes. Steps to reproduce: 1. Run app using code below 2. Slide to change label value. Actual: Label value does not change. Expected: value must change Note: Behaviour in 3.1.3.GA Value of label changes only the first time not the next time if slided again Behaviour in 3.2 Value does not change at all

var _window = Titanium.UI.createWindow();
_window.backgroundColor = 'white';
		_window.layout = 'vertical';
		//_window.top='0';
		 
		slider1 = Ti.UI.createSlider({
		    top : 30,
		    value : 0,
		    min : 0,
		    max : 50000,
		    left : 0,
		    right : 0
		});
		 
		slider1.addEventListener('touchend', function(e) {
		    slider1Change(e);
		});
		 
		slider1.addEventListener('touchcancel', function(e) {
		    slider1Change(e);
		});
		 
		function updatePerMonthLabel(_val) {
		    row.label.text = _val;
		}
		 
		function slider1Change(e) {
		    updatePerMonthLabel(slider1.value);
		}
		 
		var row = Titanium.UI.createTableViewRow();
		 
		var horizontalView = Ti.UI.createView({
		    layout : 'horizontal',
		    left : '5%',
		    right : '5%',
		    height : Ti.UI.SIZE
		});
		 
		var amountLabel = Titanium.UI.createLabel({
		    left:0,
		    text:'$0',
		    top : 0,
		    width : Ti.UI.SIZE,
		    height : Ti.UI.SIZE
		});
		 
		var yrLabel = Titanium.UI.createLabel({
		    width : Ti.UI.SIZE,
		    height : Ti.UI.SIZE,
		    text : "Year",
		    left : 10
		});
		 
		horizontalView.add(amountLabel);
		row.label = amountLabel;
		horizontalView.add(yrLabel);
		 
		amountLabel = null;
		yrLabel = null;
		 
		row.add(horizontalView);
		 
		var mainContentTableView = Titanium.UI.createTableView({
		    data : [row],
		    height : Ti.UI.SIZE
		});
		 
		_window.add(slider1);
		_window.add(mainContentTableView);
		 _window.open();

Comments

  1. Ingo Muschenetz 2013-11-26

    Resolving as duplicate of linked issue. According to [~vduggal], this is actually a regression against SDK 3.1.1, but the behavior here _should_ be unsupported and is not recommended by Google. The workaround is not not use TI.UI.SIZE. The linked issue is being kept in the backlog. If you feel that the recommended workaround does not fit your needs, please comment on the attached ticket.

JSON Source