Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1374] Android: Events are not working on Android 2.2 device, but working on simulator

GitHub Issuen/a
Resolution Date2011-04-15T02:50:42.000+0000
Affected Version/sn/a
Fix Version/sn/a
Labelsandroid, event, webview
ReporterAlper Dincer
AssigneeDon Thorp


This sniplets are working under all versions of simulator, but when I install the application on Android 2.2 (Nexus One), events are not working.
So I can't pass data between windows and webviews.


var win = Ti.UI.currentWindow;

var webCurView = Ti.UI.createWebView({url:'web2.html'});

webCurView.addEventListener('load', function() {

Titanium.App.fireEvent('pageReady',{latx:39.92, lngx:32.80, laty:39.86, lngy: 32.85});





  1. Brion Vibber 2011-04-15

    The problem I have is that the Titanium object (and thus Titanium.App.addEventListener) is undefined in the web view's JavaScript when launched on a Nexus One running the official Android 2.2 release. As with Alper's report, everything works fine in the emulator (2.2-APIs).

  2. Brion Vibber 2011-04-15

    I was able to work around this for my case by re-including the system's binding.js in my HTML file; I think there's some order of operations problem where it's getting evaluated when the WebView is set up, but before the TiApp and TiAPI objects are fully available yet:

    E/Web Console( 2106): Uncaught ReferenceError: TiAPI is not defined at :3

    I've simply copied binding.js from here:
    http://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/ti/modules/titanium/ui/widget/webview/binding.js"> http://github.com/appcelerator/titanium_mobile/blob/master/android/...

    and dropped it into my HTML before my own scripts:

    <!-- hack for initialization bug on Android --> Since it checks for the short-form 'Ti' already being set up in the global namespace, it's a no-op when everything's already been set up for us so it doesn't interfere with iPhone, or with a correctly established namespace.
  3. Brion Vibber 2011-04-15

    That'll be a <script src="binding.js"></script> of course... formatting ate the tag in post above. :)

  4. Bill Dawson 2011-04-15

    dupe #1635 and #2153 and #2514

    fixed with this commit to master (1.5.1):
    https://github.com/appcelerator/titanium_mobile/commit/12d7bf6a90db72fa0aebe538c95128c8a0cdc625"> https://github.com/appcelerator/titanium_mobile/commit/12d7bf6a90db...

  5. Lee Morris 2017-03-09

    Closing ticket as duplicate.

JSON Source