Titanium Development Tutorial-1

by admin, November 13, 2014

Use of widgets

Introduction

Widgets are self-contained components that can be easily dropped into Alloy-powered Titanium projects. They were conceived as a way to reuse code in multiple applications or to be used multiple times in the same application. Widgets have their own views, controllers, styles and assets and are laid out the same as the app directory in the Alloy project.

Importing widgets to titanium project

sample widget(Bootstrap like buttons)
https://github.com/FokkeZB/nl.fokkezb.button

1) Download the widget from the link above
2) create a folder inside the app folder with the name widgets
3) paste the nl.fokkezb.button folder
4) modify config.json

“dependencies”: {
“nl.fokkezb.button”: “1.0”
}
5) Use of the widget
<Widget src=”nl.fokkezb.button”  title=”Okay” style=”bs-success”  height=”40″ onClick=”btnSkiptute” />

Replace style=”bs-success” with bs-default,bs-warning,bs-inverse and get new styles.

If you are a beginner to titanium development my instruction is to use pre developed widgets and with experience develop widgets your self.

Use of Modules

Introduction

Modules enable you extend Titanium’s core functionality. Modules add support for device-specific hardware or operating system functionality. Modules also wrap native SDKs with Titanium-friendly JavaScript APIs to make them easier to implement within your apps. You can even create JavaScript modules for your Mobile Web projects to wrap RESTful APIs or to provide easy access to other functions.

use https://marketplace.appcelerator.com/ and google and grab a module

navigate to dist folder(android) you’ll find a zip folder extract and copy the folder to titanium home

you can find the titanium home when you go to preferences->platform->Titanium Home

Navigate to module section and paste the module folder

Use the app.js under example of each module which gives you an overall code example so no need of tutorials.

feel free to comment on this post if you need any help regarding this topic