Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8774] Android: issues displaying labels and changing properties if using textid

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-12T14:54:07.000+0000
Affected Version/sRelease 1.8.2, Release 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-08, Release 2.1.1, Release 3.0.0
ComponentsAndroid
LabelsSupportTeam, api, qe-testadded, regression
ReporterFederico Casali
AssigneeHieu Pham
Created2012-04-17T16:36:15.000+0000
Updated2012-07-16T23:55:23.000+0000

Description

Problem description

Changing label textid property causes the label to disappear.

Steps to reproduce and sample code

- Create a window, put a label with textid property. - Add an event listener on the label (or on the view) in order to modify the textid content - Click and trigger the eventListener Result: 'textid' content changed as expected - Click again Result: label disappears See attached sample code:
var  win = Titanium.UI.createWindow({
					backgroundColor:'white',
					title:'window',
					barColor:'#ff7b01',
					top:0
				});
				
			var view = Ti.UI.createView({
			top:0,
			height:80,
			right:0,
			left:0
		});	
		
		
var label =  Ti.UI.createLabel({
	font:{fontSize:30,fontFamily:'Helvetica Neue'},
	color:'red',
	left:0,
	width:'100%',
	text:'Label1',
	right:'10%',
	textid:'check'
});
	
	view.add(label);
	view.addEventListener('click',function(e){
		label.text = 'Label1 is fine';
		label.textid='new';
		// alert(label.textid);
	})
			
win.add(view)
				
win.open();
			

Additional notes

Not able to reproduce on 1.7.6

Comments

  1. Hieu Pham 2012-04-18

    textId and text properties cannot be used at the same time. One will overwrite the other. Setting textId will cause a resource lookup on that key (a key defined in Android resources), and set the label's text to the corresponding value. If this key is undefined, the text is set to an empty string. I will submit a PR with a fix such that if the key is undefined, we will not MODIFY the existing text, i.e not setting it to an empty string. Please look at http://docs.appcelerator.com/titanium/2.0/#!/api/Titanium.UI.Label for more details.
  2. Natalie Huynh 2012-05-07

    Tested with 2.0.2.v20120505151714 with Samsung Nexus S 4.0.4
  3. Evgenii Tcarev 2012-07-10

    Occurs with Xoom tablet running 4.0.3 using SDK 2.1.1.v20120705143056 and SDK 2.1.0GA.
  4. Hieu Pham 2012-07-10

    Fix for this needs to backport into 2.1.1.
  5. Neha Chhabra 2012-07-16

    Environment used for verification - Tested with Titanium SDK: 2.1.1.v20120716180600 Tested with Titanium  Studio: 2.1.1.201207161421 Device - Android Emulator 2.3.3 Machine OS - MAC 10.7.3

JSON Source