appcelerator titanium
DESCRIPTION
http://novavision-it.tn/TRANSCRIPT
DEVELOPING ANDROID APPS USING TITANIUM
Soltani KadhemWeb and Mobile Developer
• iPhone (objective-C)• Android (Java , Google Style)• RIM (Java, Blackberry)• Symbian (old school C)
What is Titanium Mobile ?
• Open source • Build native, cross-platform mobile apps• Using only JavaScript,HTML and CSS• One codebase for multiple platforms
Small intro about Titanium Studio
- Powerful Eclipse-based IDE- It will help you create, run for test and deploy (to app store) .
Ti Studio (why it so powerful)…
• It always notifies you about latest SDK and Studio updates .
Ti Studio (why it so powerful)…
• It is so smart, because it catches mistakes immediately!
Ti Studio (why it so powerful)…
• Syntax highlighting
Ti Studio (why it so powerful)…
• Content assist and more…
Project structure…
{code}
LET’S GET INTO THE INTERESTING PART. CODING…
Titanium, DESIGNING A SAMPLE UI
Ti.UI.createWindow({ backgroundColor:"#FFF"});win.open();
Titanium, ADD a container
var view = Ti.UI.createView({top:10,left:10,height:300,width:300,backgroundColor:"#AAA",borderRadius:10
});win.add(view);
Titanium, add a button
var button = Ti.UI.createButton({
title:"Click Me",top:10, left:10,
height:40, width:280});
view.add(button);
button.addEventListener("click", function(){ alert("Comment gagner de l'argent avec google"); });
Titanium, add a button
Titanium, OPEN A DIALOG
var dlg = Ti.UI.createOptionDialog({
title:"Delete?",options:
["Yes","No"],cancel:1
});dlg.addEventListener("click", function(e){
alert(e.index);});
dlg.show();
Titanium, ITS NOT ONLY ABOUT UI
• DATABASE• WEB SERVICES• MEDIA ELEMENTS• SOCIAL NETWORK
Titanium, EVERYTHING SQLITE
SQLite Manager
Why SQLite fit?
• SQLite does not need tobe «installed» before it is used.
•There is no « setup » procedure.
•There is no need for an administrator to create a new database.
•There is no real notion of « initiating a connection ».
•Accessing SQLite DB is damn easy(open,query,close).
•Faster read and write operations.
{code}
Titanium, INSTALL A DATABASE
Use database with your default data –
Create or open an existing database -
var db = Ti.Database.install( ‘test.db’, ‘DB1’)
var db = Ti.Database.open(‘DB1’)
Titanium, CREATE TABLE
db.execute(‘ CREATE TABLE IF NOT EXISTS users ( id INTEGER, Name TEXT, LastName TEXT, mail TEXT, PRIMARY KEY(id) )’);
Titanium, INSERT
var result = db.execute(“ INSERT INTO users (Name, LastName, mail) VALUES (‘Kadhem’, ‘Soltani’, ‘kadhem.soltani@outlook,com’)“);
Titanium, UPDATE
var result = db.execute(‘ UPDATE users SET Name = ‘Wael’ WHERE id = 1 );
Titanium, DELETE
var result = db.execute(‘ DELETE FROM users WHERE id = 1‘);
Titanium, READ
var result = db.execute(‘ SELECT (id, Name, LastName) FROM users WHERE id = 1);
Titanium, READ
while (result.isValidRow()) { var name = result.fieldByName(‘name’); result.next();}
Iterate through rows -
?Thank you, QUESTIONS?
http://www.youtube.com/watch?v=I6iESgpZIwEhttp://www.youtube.com/watch?v=ohvw3WebAkY
Introduction To Appcelerator Titanium
Kadhem,soltani@outlook,com