- 浏览: 7256856 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (1546)
- 企业中间件 (236)
- 企业应用面临的问题 (236)
- 小布Oracle学习笔记汇总 (36)
- Spring 开发应用 (54)
- IBatis开发应用 (16)
- Oracle基础学习 (23)
- struts2.0 (41)
- JVM&ClassLoader&GC (16)
- JQuery的开发应用 (17)
- WebService的开发应用 (21)
- Java&Socket (44)
- 开源组件的应用 (254)
- 常用Javascript的开发应用 (28)
- J2EE开发技术指南 (163)
- EJB3开发应用 (11)
- GIS&Mobile&MAP (36)
- SWT-GEF-RCP (52)
- 算法&数据结构 (6)
- Apache开源组件研究 (62)
- Hibernate 学习应用 (57)
- java并发编程 (59)
- MySQL&Mongodb&MS/SQL (15)
- Oracle数据库实验室 (55)
- 搜索引擎的开发应用 (34)
- 软件工程师笔试经典 (14)
- 其他杂项 (10)
- AndroidPn& MQTT&C2DM&推技术 (29)
- ActiveMQ学习和研究 (38)
- Google技术应用开发和API分析 (11)
- flex的学习总结 (59)
- 项目中一点总结 (20)
- java疑惑 java面向对象编程 (28)
- Android 开发学习 (133)
- linux和UNIX的总结 (37)
- Titanium学习总结 (20)
- JQueryMobile学习总结 (34)
- Phonegap学习总结 (32)
- HTML5学习总结 (41)
- JeeCMS研究和理解分析 (9)
最新评论
-
lgh1992314:
[u][i][b][flash=200,200][url][i ...
看看mybatis 源代码 -
尼古拉斯.fwp:
图片根本就不出来好吧。。。。。。
Android文件图片上传的详细讲解(一)HTTP multipart/form-data 上传报文格式实现手机端上传 -
ln94223:
第一个应该用排它网关吧 怎么是并行网关, 并行网关是所有exe ...
工作流Activiti的学习总结(八)Activiti自动执行的应用 -
ZY199266:
获取不到任何消息信息,请问这是什么原因呢?
ActiveMQ 通过JMX监控Connection,Queue,Topic的信息 -
xiaoyao霄:
DestinationSourceMonitor 报错 应该导 ...
ActiveMQ 通过JMX监控Connection,Queue,Topic的信息
针对Titanium中需要特定的功能可能需要开发者定制,如二维码等。所以需要自己开发相关的module在项目中使用。
开发环境准备
下载titanium studio
下载eclipse + ant
下载android sdk
下载android ndk
官方推荐:
注意:必须参考下面的官方网址, python在windows环境下不用安装,本身titanium studio已经装了
https://wiki.appcelerator.org/display/guides/Android+Module+Development+Guide
关于titanium自动生成module的模板在:
${Titanium SDK}\mobilesdk\win32\1.8.2\module\android\templates\src\___MODULE_ID_AS_FOLDER___
本文将简单一下关于titanium module的描述。
ant编译module工程
1)将此工程放到eclipse下(带有ant环境),编辑builder.properties文件,加上android ndk路径。如下:
android.ndk=C:\android-ndk\android-ndk-r8
针对android的NDK如果在环境变量中设置,那么就可以不再builder.properties文件中设置,否则必须设置。
模块代理类如下:
/** * This file was auto-generated by the Titanium Module SDK helper for Android * Appcelerator Titanium Mobile * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * */ package com.easyway; import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollProxy; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.util.Log; import org.appcelerator.titanium.util.TiConfig; import org.appcelerator.titanium.util.TiConvert; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiCompositeLayout; import org.appcelerator.titanium.view.TiCompositeLayout.LayoutArrangement; import org.appcelerator.titanium.view.TiUIView; import android.app.Activity; // This proxy can be created by calling Hellomodule.createExample({message: "hello world"}) @Kroll.proxy(creatableInModule=HellomoduleModule.class) public class ExampleProxy extends TiViewProxy { // Standard Debugging variables private static final String LCAT = "ExampleProxy"; private static final boolean DBG = TiConfig.LOGD; private class ExampleView extends TiUIView { public ExampleView(TiViewProxy proxy) { super(proxy); LayoutArrangement arrangement = LayoutArrangement.DEFAULT; if (proxy.hasProperty(TiC.PROPERTY_LAYOUT)) { String layoutProperty = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_LAYOUT)); if (layoutProperty.equals(TiC.LAYOUT_HORIZONTAL)) { arrangement = LayoutArrangement.HORIZONTAL; } else if (layoutProperty.equals(TiC.LAYOUT_VERTICAL)) { arrangement = LayoutArrangement.VERTICAL; } } setNativeView(new TiCompositeLayout(proxy.getActivity(), arrangement)); } @Override public void processProperties(KrollDict d) { super.processProperties(d); } } // Constructor public ExampleProxy() { super(); } @Override public TiUIView createView(Activity activity) { TiUIView view = new ExampleView(this); view.getLayoutParams().autoFillsHeight = true; view.getLayoutParams().autoFillsWidth = true; return view; } // Handle creation options @Override public void handleCreationDict(KrollDict options) { super.handleCreationDict(options); if (options.containsKey("message")) { Log.d(LCAT, "example created with message: " + options.get("message")); } } // Methods @Kroll.method public void printMessage(String message) { Log.d(LCAT, "printing message: " + message); } @Kroll.getProperty @Kroll.method public String getMessage() { return "Hello World from my module"; } @Kroll.setProperty @Kroll.method public void setMessage(String message) { Log.d(LCAT, "Tried setting module message to: " + message); } }
/** * This file was auto-generated by the Titanium Module SDK helper for Android * Appcelerator Titanium Mobile * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * */ package com.easyway; import org.appcelerator.kroll.KrollModule; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiApplication; import org.appcelerator.kroll.common.Log; import org.appcelerator.kroll.common.TiConfig; @Kroll.module(name="Hellomodule", id="com.easyway") public class HellomoduleModule extends KrollModule { // Standard Debugging variables private static final String LCAT = "HellomoduleModule"; private static final boolean DBG = TiConfig.LOGD; // You can define constants with @Kroll.constant, for example: // @Kroll.constant public static final String EXTERNAL_NAME = value; public HellomoduleModule() { super(); } @Kroll.onAppCreate public static void onAppCreate(TiApplication app) { Log.d(LCAT, "inside onAppCreate"); // put module init code that needs to run when the application is created } // Methods @Kroll.method public String example() { Log.d(LCAT, "example called"); return "hello world"; } // Properties @Kroll.getProperty public String getExampleProp() { Log.d(LCAT, "get example property"); return "hello world"; } @Kroll.setProperty public void setExampleProp(String value) { Log.d(LCAT, "set example property: " + value); } }
编译成功后会在dist目录下生成相应的zip包。
如何调用的module
1.配置tiapp.xml文件中模块
<modules> <module version="1.1">com.easyway</module> </modules>
2.将zip解压之后的modules拷贝到对应的titanium module应用的根目录中。
如下:
3.调用:
// This is a test harness for your module // You should do something interesting in this harness // to test out the module and to provide instructions // to users on how to use it by example. // open a single window var win = Ti.UI.createWindow({ backgroundColor:'white' }); var label = Ti.UI.createLabel(); win.add(label); win.open(); // TODO: write your module tests here var hellomodule = require('com.easyway'); Ti.API.info("module is => " + hellomodule); label.text = hellomodule.example(); Ti.API.info("module exampleProp is => " + hellomodule.exampleProp); hellomodule.exampleProp = "This is a test value"; if (Ti.Platform.name == "android") { var proxy = hellomodule.createExample({ message: "Creating an example Proxy", backgroundColor: "red", width: 100, height: 100, top: 100, left: 150 }); proxy.printMessage("Hello world!"); proxy.message = "Hi world!. It's me again."; proxy.printMessage("Hello world!"); win.add(proxy); }
发表评论
-
[转]年度最实用50款免费Android应用推荐
2012-11-08 16:39 3263据国外媒体报道,有人说Android应用市场比iPhone应用 ... -
GIS的学习(四十五)【转】Integration of the MBTiles format on Android
2012-10-22 17:13 2882转载自 http:/ ... -
GIS的学习(四十四)osmdroid sdcard检查
2012-10-15 16:12 2278在许多应用中使用到sdcard的检查,在osmdro ... -
GIS的学习(四十三)osmdroid基于几个经典代理类
2012-10-15 16:06 2564在osmdroid中给基于位置的代理类如下: pack ... -
Android中PopupWindow的用法(位置、动画、焦点)
2012-10-12 14:12 11425在Android中有很多级别的Window,不同级别的Wind ... -
【转】Android根据分辨率进行单位转换-(dp,sp转像素px)
2012-10-11 09:18 27069Android系统中,默认的单位是像素(px)。也就是说,在没 ... -
GIS的学习(二十九)Osmdroid 离线地图存放位置的研究和详细分析
2012-09-23 11:49 11363在手机通过osmdroid调用离线地图必须放在 ... -
GIS的学习(二十八)Osmdroid相关的开源项目
2012-09-23 11:31 25194osm 数据格式(openstreet map)与Ro ... -
GIS的学习(二十七)通过geoserver的georss访问第三方地图
2012-09-23 00:34 3529在geoserver中如果想调用第三方地图可以采 ... -
android中使用 定时更新界面定时器Timer的使用
2012-09-22 22:09 25436handler的使用 一、Handler的定义: ... -
【转】Android应用程序的自动更新升级(自身升级、通过tomcat) .
2012-09-16 15:03 7281http://blog.csdn.net/mu0206mu/a ... -
GIS的学习(二十七)OGC 的WCS WFS 及WMS 服务
2012-09-11 22:22 12026http://www.gisall.com/?6678/v ... -
GIS的学习(二十六)geotools 使用 部分代码总结
2012-09-11 22:20 5621前段时间的一个项目 本来用ae完成了种种的 查询,空间分析等等 ... -
GIS的学习(二十五)geoserver wms中的各种操作API详细讲解和使用
2012-09-10 17:42 9613官方geoserver中WMS服务中几种操作的API的详细说明 ... -
GIS的学习(二十四)android异步调用geoserver wms中的地图
2012-09-10 17:38 8053在geoserver的客户端通过wms的GetMap实现 ... -
GIS的学习(二十三)geoserver中CQL和ECQL的使用
2012-09-10 16:29 6500以下引用自官方文档: CQL and ECQL¶ CQ ... -
GIS的学习(二十二)osmdroid中添加縮放控件
2012-09-06 23:09 2742package com.geoserver.osmdroid; ... -
GIS的学习(二十一)在osmdroid 地图中添加marker 并添加事件
2012-09-06 22:27 6441我有 osmdroid,overlayswithf ... -
GIS的学习(二十)基于Geoserver的WFS服务与Openlayers实现地理查询
2012-08-30 18:48 11310基于Geoserver发布的wfs服务,与Openlayers ... -
GIS的学习(十九)Geoserver使用添加,删除,查询地图中的POI
2012-08-30 17:28 10218在geoserver自定义的地图中通过geoserver ...
相关推荐
titanium_module_jpush_android 极光推送的安卓封装(ios平台我用rpush在自己的服务器发,没做module) 作者刘明星 Appcelerator安卓开发比较悲催,无法使用google的gcm,只能绕道,用国内的服务,极光推送还不错。 ...
命令描述键绑定Titanium: Create application 创建一个新的Titanium应用程序项目-- Titanium: Create module 创建一个新的Titanium模块项目-- Titanium: Enable LiveView 启用LiveView -- Titanium: Disable ...
适用于 Android 的 Parse.com Titanium 模块关于模块该模块的存在是为了向 Appcelerator 开发人员提供一个开源(在 MIT 许可下获得许可)Android 模块来包装 Android Parse SDK 的功能。 它试图保持与 iOS Titanium ...
本机模块开发人员可以使用它来了解为Titanium构建自己的本机模块的基本和高级概念。功能性此示例模块在iOS和Android上提供以下组件: 模块/应用生命周期 查看/代理关系 发送和接收事件( fireEvent和...
回顾描述TiLookback 模块包装了 Lookback iOS SDK 以在 Titanium 移动应用程序中使用iOS 回溯 SDK 版本 0.6 HD 此模块仅应用于临时或开发项目。 如果您希望在 App Store 项目中使用它,请将此存储库中的 Loopback....
三重演示三重演示先决条件 >= 0.10 用于Android开发的 用于 iOS 开发的 注册一个设置如果您已经安装了 Titanium 环境,则可以直接跳到安装triple . $ sudo npm install -g titanium$ titanium setup$ titanium sdk ...
$ ti create --type module --platforms ios --id foo --name foo --workspace-dir . --url http:// $ cd foo/iphone $ ./build.py $ yatriple -a ../example/app.js -m ./foo-iphone-1.0.0.zip 安装 $ npm install ...
该项目的目标是存储开发本机Node.js插件所需的所有逻辑,而不必检查NODE_MODULE_VERSION并使自己陷入宏观NODE_MODULE_VERSION 。 该项目还包含一些帮助程序实用程序,这些实用程序使附加组件的开发更加愉快。新闻与...
app为实际开发module。其他module视功能进行添加 app目录具体文件夹功能: ./bean/目录为统一实体类存放目录,在该目录下根据具体的模块分别建立二级目录存放bean对象。如./bean/center存放个人中心的bean对象。 ./...
此应用程序是为 ShineSeniors 项目开发的。 它基于 Django 1.6.10 和两勺 django 模板。 主要目标 来自MQTT经纪人的Demulplex数据(包括传感器读数,日志和统计信息) REST API 层 设置 在你的 bashrc 文件中,根据...
HazPanEnCasa 该项目的生成: 版本11.0.2 版本5.2.3 版本11.0.3 版本5.0开发服务器您必须将以下命令复制并粘贴到终端中: git clone git@github.com:hazpanencasa/webapp.gitnpm install然后运行ng serve开发服务器...
您还可以使用ng generate directive|pipe|service|class|guard|interface|enum|module 。 建造 运行ng build来构建项目。 构建工件将存储在dist/目录中。 使用--prod标志进行生产构建。 运行单元测试 运行ng test以...
开发服务器为开发服务器运行ng serve 。 导航到http://localhost:4200/ 。 如果您更改任何源文件,该应用程序将自动重新加载。代码脚手架运行ng generate component component-name生成一个新的组件。 您还可以使用...
开发服务器为开发服务器运行ng serve 。 导航到http://localhost:4200/ 。 如果您更改任何源文件,该应用程序将自动重新加载。代码脚手架运行ng generate component component-name生成一个新的组件。 您还可以使用...
您还可以使用ng generate directive|pipe|service|class|guard|interface|enum|module 。 建造 运行ng build来构建项目。 构建工件将存储在dist/目录中。 使用--prod标志进行生产构建。 运行单元测试 运行ng test以...
您还可以使用ng generate directive|pipe|service|class|guard|interface|enum|module 。 建造 运行ng build来构建项目。 构建工件将存储在dist/目录中。 使用--prod标志进行生产构建。 运行单元测试 运行ng test以...
开发服务器为开发服务器运行ng serve 。 导航到http://localhost:4200/ 。 如果您更改任何源文件,该应用程序将自动重新加载。代码脚手架运行ng generate component component-name生成一个新的组件。 您还可以使用...
开发服务器为开发服务器运行ng serve 。 导航到http://localhost:4200/ 。 如果您更改任何源文件,该应用程序将自动重新加载。代码脚手架运行ng generate component component-name生成一个新的组件。 您还可以使用...
开发服务器为开发服务器运行ng serve 。 导航到http://localhost:4200/ 。 如果您更改任何源文件,该应用程序将自动重新加载。代码脚手架运行ng generate component component-name生成一个新的组件。 您还可以使用...
您还可以使用ng generate directive|pipe|service|class|guard|interface|enum|module 。 建造 运行ng build来构建项目。 构建工件将存储在dist/目录中。 使用--prod标志进行生产构建。 运行单元测试 运行ng test以...