We love designing and developing websites, but what really drives us is solving problems and cultivating strong relationships with our clients
Getting started with Titanium development for Android and Iphone
By : shabda
This is the third post in our mobile app development series. ( You may want to read Phonegap and Android with Java.)
Like last time we will build an App which allows calculating the tax payable, per the rules here. We will use Titanium Mobile
Installing Titanium
Download and install the fairly small Titanium from their sites. Once you download and start it, it will download and install more components. You can then create a new project from their UI.
Layout the Layout
You can add UI widgets and lay them out using Javascript. You need to use Titanium's API, to create the UI.
Titanium execution starts in app.js. We will modify this file to add the layout code.
You can add a label like this
Titanium.UI.createLabel({
color:'#999',
text:label_text,
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'left',
width: 'auto',
height: 'auto',
top: 5
});
Similarly you can create a Button and TextInput as
Titanium.UI.createTextField(
{
....
}
);
Titanium.UI.createButton({
...[Options]
})
Create a window as Titanium.UI.createWindow({}). and add these Items to it via window.add. Your widgets have been added to the UI, and should show up, in the simulator. Here is what mine looks like. You can get the code for the layout at here.
Code the code
We now need to add the code to handle button clicks, calculate the tax, and update the UI with the tax. Since our code for this is going to be Javascript, we can easily reuse the tax calculation parts from our Phonegap app.
function getTax(taxableIncome){
var taxOnThisSlab;
if (taxableIncome < 160000) {
return 0;
}
///More code to calculate the tax
//....
}
function calculateTax(income, investment, infra_investment, housing_interest, medical_premium){
investment = Math.max(0, Math.min(investment, 100000));
///More code to calculate the tax
//....
}
Now we add a EventListener to the Button we added and this is used to calculate the tax and update the Label for showing the text.
calculateTaxBut.addEventListener("click", function(){
var income = income_f.value;
var investment = investment_f.value;
//More code to get the values and update the tax area.
//.....
var tax = calculateTax(income, investment, infra_investment, housing_interest, medical_premium);
calculated_tax.text = ""+tax;
});
And we are done
Overall, the experience with Titanium was OK. The Titanium developer UI could have been better, the UI is Unintuitive. Building for Android is very slow. Lunch button in their developer UI seems to stop working at random intervals. However the promise of building native apps is very alluring, and I would be working more with Titanium.
Resources
- Finished code on Github
- [Tutorial: Building the same app with Obj-c] - Todo
- Tutorial: Building the same app with Phonegap
- Tutorial: Building the same app with Java:Android
- Code: Phonegap app on Github
- Code: Java app on Github
- Code: Obj-C app on Github
Comments
Reactions
http://agiliq.com/blog/2011/02/getting-started-with-titanium-development/ Getting started with Titanium development for Android and Iphone
- Test Driven Development in Python
- Deploying Django apps on Heroku
- Developing android applications from command line
- Deploy Django App in 5 Easy Steps
- Project Management Tools for Start-Ups
- Generating a pdf from an image using PIL and django
- Dynamically attaching SITE_ID to Django Caching
- Screencast: How to deploy Django on Heroku
- Deploying Django apps on Heroku
- How to use pep8.py to write better Django code
- rails
- django
- linkroundup
- django opinion
- opinion
- business
- API
- appengine
- python
- satire
- startup
- Uncategorized
- marketing
- personal
- rambling
- search
- interviews
- seo-interviews
- 5startupideas
- ideas
- seo
- tips
- forms
- paypal
- utilities
- datetime
- web2.0
- Amazon
- algorithms
- presentations
- products
- pinax
- satchmo
- ecommerce
- microsoft
- yahoo
- book
- tutorial
- models
- aggreagtion
- meta
- India
- apps
- about
- CSS
- Design
- wordpress
- test slug
- vim
- urls
- reviews
- javascript
- xmpp
- emacs
- Typography
- Grid Theory
- Color Theory
- iphone
- android
- titanium
- mobile applications
- CSS3
- Browser Compatibility
- mobile
- jobs
- lamson
- django setup
- files
- upload
- jsTree
- hierarchical view
- web page
- Treeview
- coffeescript
- request
- response
- South
- django south
- django migration
- --fake
- screencasts
- django caching
- SITE_ID prefix
- review
- code hosting
- comparison
- unfuddle
- fogbugz
- assembla
- github
- project management
- ticketing system
- gunicorn
- deploy
- nginx
- ubuntu
- vps
- android terminal
- terminal
- programming
- TDD
- Test Driven
- Development
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- October 2011
- September 2011
- July 2011
- June 2011
- April 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- June 2010
- April 2010
- March 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- April 2009
- March 2009
- February 2009
- November 2008
- October 2008
- June 2008
- May 2008
- April 2008
Our website offers the Cheap Rosetta Stone on sale,such as these very popular kinds: Rosetta Stone Spanish,Rosetta Stone German,Rosetta Stone Italian and so on,besides,there are many friendly customers who left useful Rosetta Stone Reviews,which maybe the good guide for you!
All the Rosetta Stone are 100% satisfaction guaranteed,and free shipping.We guarantee its quality,and all money will be refund if the goods are not satisfied.
welcome to make a purchase.