2013-03-06 25 views
1

對於我的Titanium應用程序,我正在編寫一個自定義的原生android模塊,其中包含一個由我想要重用的少量android活動組成的android jar。如何從我的應用程序調用這些活動。在Titanium中調用本機android活動

回答

2

這從來自直鈦Android的模塊開發指南https://wiki.appcelerator.org/display/guides/Android+Module+Development+Guide

要使用模塊中的鈦移動應用程序,請按照下列步驟操作:

複製模塊壓縮到鈦的應用程序的根目錄,或向 根系統安裝鈦在應用程序的tiapp.xml,添加 以下XML內:

<!-- $MODULE_VERSION should be the same as "version" in the module manifest --> 
<modules> 
    <module version="$MODULE_VERSION">$MODULE_ID</module> 
    <!-- For example, if we were adding the calc module: --> 
    <module version="0.1">org.appcelerator.calc</module> 
</modules> 

使用需要的功能加載在應用程序的代碼模塊, 例:下一次應用程序啓動或建成

var Module = require('$MODULE_ID'); 
// For example, to load the calc module: 
var Calc = require('org.appcelerator.calc'); 

,模塊應 包括在申請