Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

noob: getting started advice

I seem to be struggling with development much more than I expected, which is surprising since I am quite familiar with several languages, including java and groovy, and have been developing apps for 30+ years. I am probably a journeyman or less when it comes to javascript, however. Sure, I can read what others have written, can easily write fairly decent, if somewhat simple, functions myself for deployment on web clients. However, I do not have in-depth knowledge of any particular frameworks. When I try things in Titanium and refer to the API docs, it seems information is lacking, and I am guessing it is presumed knowledge. So, do I need to study something else to help me with my Titanium development for mobile phones? Perhaps a general primer on javascript, such as The Javascript Bible? Or, something more specific, like jQuery? I fear the former would be too basic, voluminous and would help me in the end, and that the latter might be totally irrelevant to mobile phone development. Suggestions? Thanks!

— asked June 19th 2010 by Bill Turner
  • javascript
  • mobile
  • newbie
  • jQuery is a close approximation of how coding is with Ti. The main difference is that Ti uses a factory pattern which often throws people.

    As Bryce mentioned - the demos & specifically the kitchensink is a helpful resource. The API docs are handy mostly for properties/params and the namespace.

    There are fairly substantial diffs between what works on the iPhone & Android - so if you're doing cross-platform development ensure you have the KS app available in both emulators as a reference.
    Trust the KS over the API docs - it's working code for a start & method/namespace casing is correct, whereas there's a few issues with the API docs which can throw you.

    A handy process when you're starting is to have 2 projects - one of the app you're developing and another as a testbed. Use the testbed when you're having a specific problem that you want to debug - it'll save you from polluting your app as you figure out the issue. Building the UI is currently very verbose - so it's easy to tangle yourself up in JS.

    Before you go down inevitable route of creating your own wrappers or building helpers for you app - make sure you've built 5-8 screens and feel comfortable with a breadth of Ti elements. There are many places to slip up and you'll save yourself a lot of time. Currently debugging essentially boils down to try/catch & debug.writeln.

    — commented June 20th 2010 by David Ashwood
  • Ah - just remembered something that also trips people up. Ti is pretty much async so you'll need lean the event system fairly heavily with built-in & custom events.
    It's pretty reliable but doesn't support chaining events of the same name (so you can't have 2 event handlers on the same object for "open"), sometimes has issues with delegates and while you can pass objects between what's firing the event and the event handler, only data properties are exchanged, methods aren't. So you'll need to pass ID's around and then reference the source data if you attach methods to your own objects.

    — commented June 20th 2010 by David Ashwood

1 Answer

  • I agree, the docs are extremely lacking. I figured most of the api's out by looking at the test apps on github. Take a look at it.


    — answered June 20th 2010 by Bryce Wilkinson
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.