Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2891] Android Webview fireEvent doesn't work if a custom module is included in the project

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2012-02-14T14:48:58.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules, Titanium SDK & CLI
Labelsandroid, custom, fireevent, module, webview
ReporterMark Burggraf
AssigneeJosh Roesslein
Created2012-02-11T11:29:09.000+0000
Updated2016-03-08T07:47:51.000+0000

Description

In Android, a webview can can call Titanium.App.fireEvent just fine UNLESS you have a custom module in your project. Once you call a custom module with the require() syntax, all webview fireEvent calls fail. See the complete example below (you'll need to add your own custom module): // if you uncomment the external module line below, webview can no longer call fireEvent! //var SQLOBJ = require("com.dmarie.sql"); var win = Titanium.UI.createWindow({ backgroundColor : '#fff' }); Titanium.App.addEventListener("testEvent",function(e){ Titanium.API.info("****testEvent fired..."); alert("it works:" + e.obj); }) var webview = Titanium.UI.createWebView({ html : ""+ "

webview

" }); win.add(webview); win.open();

Attachments

FileDateSize
app.js2012-02-11T11:29:09.000+0000654

Comments

  1. Mark Burggraf 2012-02-13

    This only happens with our module (com.dmarie.sql) which uses a lot of native .c code and the NDK. Also of note, is that if the require("com.dmarie.sql") is moved AFTER the win.open() call, the bug does not occur. Third, after require("com.dmarie.sql") is called, all webview objects have the problem. Even if those webviews are in other windows, or declared in a separate commonJS module.
  2. Mark Burggraf 2012-02-14

    The problem was in the custom module. Creating a new instance of AppModule caused the problem: module = new AppModule() Instead, we changed this reference to: AppModule app = (AppModule)TiApplication.getInstance().getModuleByName("App"); This problem is now resolved.
  3. Josh Roesslein 2012-02-14

    Confirmed resolved by reporter and no further action required from our end.

JSON Source