Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3083] Android: setTimeout won't fire in heavyweight window's own JS context (i.e., new activity+ url) the first time

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-05-10T20:17:25.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.7.0, Sprint 2011-18
ComponentsAndroid
Labelsandroid, defect, release-1.6.1, release-1.7.0, reported-1.5.1, rplist
ReporterBill Dawson
AssigneeMarshall Culpepper
Created2011-04-15T03:36:29.000+0000
Updated2011-05-13T10:17:33.000+0000

Description

Titanium 1.6.0 2fab4fc209, Android 2.2 (with Google APIs) emulator. The problem below also does not work in 1.5.1, so I guess it's not really a regression. Didn't try anything older than that.

If you put a setTimeout in a heavyweight window with its own js context (i.e., with a url), it won't fire the very first time you go to the window. If you back out and go back in again, it will.

app.js:

Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({  
    title:'Test',
    backgroundColor:'#000',
    exitOnClose: true,
    url: 'win.js',
    fullscreen:false  // makes it heavyweight
});
win.open();

win.js:

setTimeout(function(){Ti.API.info('Timeout firing');},3000);

Do the following:

  • build and launch.

  • watch logcat -- "Timeout firing" will not appear.

  • back out

  • relaunch & watch logcat. You'll see the firing message.

Comments

  1. Bill Dawson 2011-04-15

    Maybe this only happens when the heavyweight window is the first window showing in the app. Haven't tested.

  2. Pedro Enrique 2011-04-15

    There is a http://developer.appcelerator.com/helpdesk/view/76531">helpdesk ticket that has also encounter this problem. The code provided is very similar to the one above. I changed the "fullscreen" property from false to true, and it makes no difference. On Ti. SDK 1.5.1 it works as expected.

    Tested with Ti. SDK 1.6.1
    Android Emulator APIs 2.2 Screen HVGA

  3. hal 2011-04-15

    Note ticket #3184 which may be related.

JSON Source