Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9104] Android: getVisible() / getEnabled() functions could return null value

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-02-21T14:24:10.000+0000
Affected Version/sRelease 2.1.0, Release 2.0.1
Fix Version/sn/a
ComponentsAndroid
Labelsapi, exalture
ReporterFederico Casali
AssigneeSunila
Created2012-05-10T18:01:26.000+0000
Updated2017-03-30T21:25:03.000+0000

Description

Problem description

Boolean functions like getVisible() or getEnabled() can return null value

Code sample

var win = Ti.UI.createWindow({
	exitOnClose:true
});
var view = Ti.UI.createView({
	top:0,
	left:0,
	width: 10, 
	height:10
});

var button = Ti.UI.createButton({
	title:'Click Me!'
});

button.addEventListener('click', function(e) { 
	alert(view.getVisible());
        Ti.
	view.setVisible(!view.getVisible()); 
});


win.add(button);
win.add(view);

win.open();
Result: After running the sample code, click on the button to execute view.getVisible(), which return value 'null'. Expected result: If the property was never defined by the user, then the default value should be returned.

Comments

  1. Sunila 2013-02-20

    This works correctly for me if I change the line Ti.view.setVisible(!view.getVisible()); to view.setVisible(!view.getVisible());
  2. Sunila 2013-02-21

    This works if I change the line Ti.view.setVisible(!view.getVisible()); to view.setVisible(!view.getVisible());
  3. Lee Morris 2017-03-30

    Closing ticket as I am unable to reproduce the issue using the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source