Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-891] Android: window focus, blur events missing

GitHub Issuen/a
Resolution Date2011-04-17T01:54:35.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
Labelsandroid, defect
ReporterDon Thorp
AssigneeMarshall Culpepper


Implement window focus/blur




  1. kosso 2011-04-15

    This is crucial to how my apps work when users change tabs. Since a few of the tabs use the same code in different contexts - eg: twitter timelines for friends, mentions, favorites etc. I suppose I could code around it for now and use copies of various scripts.

    Any idea when this might get addressed?

    It's a bit of a showstopper.

  2. Marshall Culpepper 2011-04-15

    @kosso can you paste a boiled down use case for you app? we'd like to get this fixed

  3. kosso 2011-04-15


    Try this: http://pastie.org/1035404">http://pastie.org/1035404

    It contains the JS required for app.js and test.js - for a simple test

    The use case for this is for (example) a Twitter client, where each tab is used for the list of tweets.
    They all the use same functions based in app.js but with differnt contexts and 'request_type' (eg: friends, mentions, favorites, etc.) - The API requests and all the tableView building all uses functions in app.js too.

    It seems that Ti on Android does not support the Window focus event which I use to see if the user has changed tab (and if it needs to request more data etc) and also it seems that it also does not support the ability for me to attach the name of the function in app.js as a window property when I build it - which works fine in iOS.

    Hope this helps! ;)


  4. Jon Clarke 2011-04-15


    The window focus and blur events are crucial for us!

    We use the window blur event to cancel pending asynchronous HTTP requests that we don't wish to continue when the user selects another tab bar option, for example.


  5. Jick Steen 2011-04-15


    I just noticed that it does not work in 1.3.2, too. We want to use the 'blur' to open a specific window cause we do not want to display the previous opened window when the user presses the back button.

    Hope this will be fixed/implemented soon.


  6. Don Thorp 2011-04-15

    (from [17c619b957a9ace9c405b4e2ebc61dddbcd15b22]) [#891 state:resolved] Fake fired after context loaded, fire during onStart if the proxy is available for focus. Fire in onStop if there is a proxy for blur. http://github.com/appcelerator/titanium_mobile/commit/17c619b957a9ace9c405b4e2ebc61dddbcd15b22"> http://github.com/appcelerator/titanium_mobile/commit/17c619b957a9a...

  7. Eli Mor 2011-04-15

    This issue is still broken in 1.6.1
    Tried the same code as copied from http://pastie.org/1035404">http://pastie.org/1035404.
    This is the output when switching between the windows.

    [INFO] Deployed testing ... Application should be running. [INFO] [18,725] this is test.js : request_type:test_one [INFO] [17,47175] this is test.js : request_type:test_two

    Testing on android emulator

JSON Source