Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6227] Android: animate callback never gets executed when using Ti.UI.createAnimation

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-21T04:54:48.000+0000
Affected Version/sRelease 1.8.0, Release 2.0.1
Fix Version/sRelease 2.0.1, Release 3.0.0, Sprint 2012-19 API, 2012 Sprint 19
ComponentsAndroid
Labelsapi, module_animation, parity, qe-review, qe-testadded
ReporterJon Alter
AssigneeHieu Pham
Created2011-11-17T18:23:25.000+0000
Updated2013-11-27T12:16:24.000+0000

Description

Animate callback never gets called if you use Ti.UI.createAnimation. It get called if you use an object instead. Step 1: Run the code below Step 2: click the window Step 3: notice that the info statement never shows Step 4: in animate() replace 'animation' with 'animationObj'. Step 5: run code Step 6: click the window Step 7: notice the info statement in the callback shows up.
var win = Ti.UI.createWindow({
	backgroundColor:'blue'
});

win.addEventListener('click',function(e){
	Ti.API.info('CLICKED');
	var animation = Ti.UI.createAnimation({
		backgroundColor:'red',
		duration: 500
	});
	var animationObj = {backgroundColor:'red', duration:2000};
	win.animate(animation, function(){
		Ti.API.info('DONE!!!');
	});
});

win.open();

Workaround(s)

1. use an object for your animation 2. animation.addEventListener('complete', function(){});

Comments

  1. Junaid Younus 2012-05-17

    Tested on 2.0.1GA2 with a Samsung Galaxy S2, unable to reproduce this issue. Ticket closed.
  2. Neha Chhabra 2012-08-14

    This still exists on 2.0.1.GA2
  3. Natalie Huynh 2012-12-05

    Tested with 3.0.0.20121204144658 on Droid 1 2.2.3
  4. jithinpv 2013-11-27

    Anvil test case added. PR link: https://github.com/appcelerator/titanium_mobile/pull/5037

JSON Source