Rectangle 27 18

I have been working with Titanium for over a week now and feel like I have a good feel about its weakness.

1) If you hoping you use the same code on multiple platforms good luck! You'll see something like backgroundGradient and be amazed until you find out android version doesn't support it. Then have to revert to using a gradient image, might as well use it for both versions to make the code easier right?

2) A lot of weird behaviors, on the Titanium android sdk you need to understand what a "heavy" window is just to get the back button to work, or even better orientation event tracking. This isn't how the android platform really is, its just how Titanium tries to make their API work.

3) Your thrown in the dark, Things will crash and you have to start to comment code and then when you find it, never use it. There are certain obvious bugs, like orientation and percents on android that have been a problem for over six months.

4) Bugs .... there are a lot of bugs and they will be reported, sit around for months, get fixed in a few days. I am surprised they even are planning to release a black berry mobile sdk when there are so many other problems with android.

5) Titanium Iphone versus Titanium Android javascript engines are completely different. On android version you can download remote javascript files, include and use libraries like mootools, jquery and so on. I was in heaven when I found this out because I didn't have to keep compiling my android app. The android apk installation process takes so long! Iphone none of that is possible, also the iphone version has a much faster javascript engine.

If you stay away from a lot of the native UI parts, i.e instead use setInterval to detect orientation changes, sticking with gradient images, forget about the back button, build your own animations, forget window header, toolbars, and dashboard. You really can make an api that works on both that doesn't require of lot of rewriting. But at that points its just as sluggish as a webapp.

So is it worth it? After all the pain, its worth every minute. You can abstract the logic and just build different UI for each rather then if elseing everywhere. Titanium lets you make fluid applications, that feel fast. You lose the powerful layout abilities of each platform but if you think simple, things can get done under a single language.

Why not a web app? On entry level market android phones its horribly slow to generate a webview and consumes a lot of memory you could be using to do more complex logic.

iphone - Comparison between Corona, Phonegap, Titanium - Stack Overflo...

iphone android html mobile-website
Rectangle 27 18

I have been working with Titanium for over a week now and feel like I have a good feel about its weakness.

1) If you hoping you use the same code on multiple platforms good luck! You'll see something like backgroundGradient and be amazed until you find out android version doesn't support it. Then have to revert to using a gradient image, might as well use it for both versions to make the code easier right?

2) A lot of weird behaviors, on the Titanium android sdk you need to understand what a "heavy" window is just to get the back button to work, or even better orientation event tracking. This isn't how the android platform really is, its just how Titanium tries to make their API work.

3) Your thrown in the dark, Things will crash and you have to start to comment code and then when you find it, never use it. There are certain obvious bugs, like orientation and percents on android that have been a problem for over six months.

4) Bugs .... there are a lot of bugs and they will be reported, sit around for months, get fixed in a few days. I am surprised they even are planning to release a black berry mobile sdk when there are so many other problems with android.

5) Titanium Iphone versus Titanium Android javascript engines are completely different. On android version you can download remote javascript files, include and use libraries like mootools, jquery and so on. I was in heaven when I found this out because I didn't have to keep compiling my android app. The android apk installation process takes so long! Iphone none of that is possible, also the iphone version has a much faster javascript engine.

If you stay away from a lot of the native UI parts, i.e instead use setInterval to detect orientation changes, sticking with gradient images, forget about the back button, build your own animations, forget window header, toolbars, and dashboard. You really can make an api that works on both that doesn't require of lot of rewriting. But at that points its just as sluggish as a webapp.

So is it worth it? After all the pain, its worth every minute. You can abstract the logic and just build different UI for each rather then if elseing everywhere. Titanium lets you make fluid applications, that feel fast. You lose the powerful layout abilities of each platform but if you think simple, things can get done under a single language.

Why not a web app? On entry level market android phones its horribly slow to generate a webview and consumes a lot of memory you could be using to do more complex logic.

iphone - Comparison between Corona, Phonegap, Titanium - Stack Overflo...

iphone android html mobile-website
Rectangle 27 18

I have been working with Titanium for over a week now and feel like I have a good feel about its weakness.

1) If you hoping you use the same code on multiple platforms good luck! You'll see something like backgroundGradient and be amazed until you find out android version doesn't support it. Then have to revert to using a gradient image, might as well use it for both versions to make the code easier right?

2) A lot of weird behaviors, on the Titanium android sdk you need to understand what a "heavy" window is just to get the back button to work, or even better orientation event tracking. This isn't how the android platform really is, its just how Titanium tries to make their API work.

3) Your thrown in the dark, Things will crash and you have to start to comment code and then when you find it, never use it. There are certain obvious bugs, like orientation and percents on android that have been a problem for over six months.

4) Bugs .... there are a lot of bugs and they will be reported, sit around for months, get fixed in a few days. I am surprised they even are planning to release a black berry mobile sdk when there are so many other problems with android.

5) Titanium Iphone versus Titanium Android javascript engines are completely different. On android version you can download remote javascript files, include and use libraries like mootools, jquery and so on. I was in heaven when I found this out because I didn't have to keep compiling my android app. The android apk installation process takes so long! Iphone none of that is possible, also the iphone version has a much faster javascript engine.

If you stay away from a lot of the native UI parts, i.e instead use setInterval to detect orientation changes, sticking with gradient images, forget about the back button, build your own animations, forget window header, toolbars, and dashboard. You really can make an api that works on both that doesn't require of lot of rewriting. But at that points its just as sluggish as a webapp.

So is it worth it? After all the pain, its worth every minute. You can abstract the logic and just build different UI for each rather then if elseing everywhere. Titanium lets you make fluid applications, that feel fast. You lose the powerful layout abilities of each platform but if you think simple, things can get done under a single language.

Why not a web app? On entry level market android phones its horribly slow to generate a webview and consumes a lot of memory you could be using to do more complex logic.

iphone - Comparison between Corona, Phonegap, Titanium - Stack Overflo...

iphone android html mobile-website
Rectangle 27 6

Came up with a working solution, not any less dirty but it works and returns data in the format I want.

function soapResponseToJson(xml) {
    var json = xmlToJson(xml).Body;

    console.debug(json);

    var response = {};
    for (var outterKey in json) {
        if (json.hasOwnProperty(outterKey)) {
            temp = json[outterKey];
            for (var innerKey in temp) {
                if (temp.hasOwnProperty(innerKey)) {
                    response[innerKey] = temp[innerKey].text;
                }
            }
        }
    }

    console.debug(response);
    return response;
}

// Changes XML to JSON
function xmlToJson(xml) {

    // Create the return object
    var obj = {};

    if (xml.nodeType == 1) {// element
        // do attributes
        if (xml.attributes.length > 0) {
            obj["@attributes"] = {};
            for (var j = 0; j < xml.attributes.length; j++) {
                var attribute = xml.attributes.item(j);
                obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
            }
        }
    } else if (xml.nodeType == 3) {// text
        obj = xml.nodeValue;
    }

    // do children
    if (xml.hasChildNodes()) {
        for (var i = 0; i < xml.childNodes.length; i++) {
            var item = xml.childNodes.item(i);
            var nodeName = item.nodeName.substring(item.nodeName.indexOf(":") + 1).replace('#', '');
            if ( typeof (obj[nodeName]) == "undefined") {
                obj[nodeName] = xmlToJson(item);
            } else {
                if ( typeof (obj[nodeName].push) == "undefined") {
                    var old = obj[nodeName];
                    obj[nodeName] = [];
                    obj[nodeName].push(old);
                }
                obj[nodeName].push(xmlToJson(item));
            }
        }
    }
    return obj;
};

module.exports = soapResponseToJson;
{
    linkAppResponse :     {
        result :         {
            text : true;
        };
        uuid :         {
            text : "e4f78c5f-1bc2-4b50-a749-19d733b9be3f";
        };
    };
}
{
    result : true;
    uuid : "e4f78c5f-1bc2-4b50-a749-19d733b9be3f";
}

I'm going to leave this question open for a while in case someone comes up with a better solution.

javascript - SOAP response (XML) to JSON - Stack Overflow

javascript xml json soap titanium
Rectangle 27 1

I found the solution. The Java scheduler HTTP request is POST request and in the NodeACS app for index method I haven't mentioned method attribute. Now I mentioned "method":"POST" then its working fine.

javascript - Node ACS 404 Not found response code to Java http client ...

java javascript node.js express titanium
Rectangle 27 0

In addition to what MRT answered that is correct and working, you could use this code that avoid the use of url property as recommended here: Titanium 3.X documentation

tableview.addEventListener('click',function(e){
    hotelWin = require('/yourpath/hotelpage');
    var hotelW = new hotelWin(e.row.title, e.row.id)
  });
function external(title, id) {
    var hotelPageWin = Titanium.UI.createWindow({
    //properties here
    });

    //You have available here two variables: 
    //title with assigned the value of e.row.title
    //id with assigned the value of e.row.id

    hotelPageWin.open();

    return hotelPageWin;
};

module.exports = external;

how to use the e.row.title and id on next page

You have the values in two variables. I updated the comment in the code.

@maxdangelo code is also working N good way. But, Satheesh using that type code that's why, I suggest CreateWindow and currentWindow method. And That is also good and working. Depend on you what you Like and perform your tasks.... :)

javascript - how to pass data from one window to another in titanium (...

javascript titanium
Rectangle 27 0

I've come across this as well. When adding an array to a TiProxy object (View, Window, button etc.) it doesn't work as expected. You need to manipulate the array 'off' the proxy, then re-set it. I don't know if this is a bug or just a limitation of properties on TiProxy objects. Here is an example that behaves the same on iOS under Titanium Mobile SDK 1.7.5:

var proxy = Ti.UI.createView();  //this can be any TiProxy object

proxy.someArray = [];
proxy.someArray.push( '1' );
proxy.someArray.push( '2' );
Ti.API.info("Array modified directly on TiProxy object" );
Ti.API.info(proxy.someArray );

var myArray = [];
myArray.push( '1' );
myArray.push( '2' );
proxy.someArray = myArray;
Ti.API.info("Array modified outside TiProxy object" );
Ti.API.info( proxy.someArray );

proxy.someArray.push( '3' );
Ti.API.info("This will be unchanged" );
Ti.API.info(proxy.someArray );

var changeArray = proxy.someArray;
changeArray.push('3');
proxy.someArray = changeArray;
Ti.API.info("This is how you must do it." );
Ti.API.info(proxy.someArray );
[INFO] Array modified directly on TiProxy object
[INFO] []
[INFO] Array modified outside TiProxy object
[INFO] [ 1,  2 ]
[INFO] This will be unchanged
[INFO] [ 1,  2 ]
[INFO] This is how you must do it.
[INFO] [ 1, 2, 3 ]

Finding out the behavour on Android is a lot harder bacause Ti.API.info(proxy.someArray ); just returns an object reference.

javascript - Empty array after adding elements using Titanium Appceler...

javascript arrays titanium appcelerator
Rectangle 27 0

missing this in your textfield "returnKeyType : Ti.UI.RETURNKEY_DONE,"

javascript events - Appcelerator Titanium - hide keyboard is not worki...

javascript-events titanium appcelerator appcelerator-mobile titanium-mobile
Rectangle 27 0

I found the solution.. here's the working code :

var listViewRow;


        listViewRow = {
            template:'listViewRowTemplate',
            properties:{backgroundColor:'green'},
            _data:myData,
            lblIndicator:_globals.get('combine')(_styles.get('label.normal'), {
                _id:'indicator',
                left:'10dp',
                backgroundImage:bgIndicator,
                backgroundSelectedImage:bgIndicatorHover,
                height:'40dp',
                width:'40dp',
                top:'5dp'
            }),
            lblCustomer:_globals.get('combine')(_styles.get('label.normal'), {
                _id:'customer',
                text:myData[i].CustomerShortDesc,
                left:'50dp',
                top:'0dp',
                height:'50dp'
            }),
            menuView:_globals.get('combine')(_styles.get('view.tableview.header'), {
                _id:'menu',
                left:'10dp',
                height:'40dp',
                width:_globals.get('app.platformWidth') * 0.7,
                top:'50dp'
            }),
            lblName:_globals.get('combine')(_styles.get('label.normal'), {
                _id:'name',
                left:'10dp',
                text:'This is for name',
                color:'red',
                height:'40dp',
                width:'40dp',
                top:'5dp'
            })
        };

        listViewData.push(listViewRow);

        section.setItems(listViewData);

javascript - How to add nested childTemplates inside titanium android ...

javascript android listview titanium titanium-mobile
Rectangle 27 0

You must use Google API SDK to use the geolocation on Android

javascript - Appcelerator Geolocation not working on Android - Stack O...

javascript android geolocation titanium
Rectangle 27 0

Its Ti.Platform not Ti.platform

sorry.I have tried with Ti.Platform only. corrected the spelling mistake.

ok so are you opening google site or just a give a example.. if you are opening some other url then you just need to encode that url using encodeURI. docs.appcelerator.com/titanium/3.0/#!/api/

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.

@Mitul: The problem is i'm getting runtime error like "Uncaught Error:java Exception occured - Ti.Platform.openURL()". It was working fine in Titanium 3.0.2 version. This error comes only when i use Titanium 3.1.3 version. I doesn't think encoding URL will solve the problem because i have been using the unencoded "Google links" previously(in 3.0.2) which works fine..

javascript - OpenUrl() property not working in Titanium 3.1.3 - Stack ...

javascript titanium titanium-mobile
Rectangle 27 0

This seems to have gotten it working... In the HTML file I had to define the var Ti = window.parent.TI inside the function

<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<style> html, body { margin: 5px; padding: 0px; } p {margin: 0; text-indent: 9.0pt;font-size: 13pt;line-height: 15pt;}sup{vertical-align: super;color: black;font-weight:bold;margin-right:3px;font-size: 8pt;}</style>
    <script type="text/javascript">
    function fire(e){
    var Ti = window.parent.Ti;
    alert("Before Ti.App.fireEvent");
      Ti.App.fireEvent("fromWebview",{});
      alert("After Ti.App.fireEvent");
    }
    </script>
  </head>
  <body>
  <a href="#" onClick="fire()">Click this link to execute the fire() function in the embedded script of this local page</a>
  </body>
</html>

javascript - Titanium Alloy Webview Ti.App.fireEvent NOT working - Sta...

javascript android webview titanium titanium-alloy
Rectangle 27 0

I got it working now, The issue was that I was trying to write to file in read-only directory

Ti.Filesystem.applicationDataDirectory: A read/write directory accessible by your app. Place your application-specific files in this directory. The contents of this directory persist until you remove the files or until the user uninstalls the application

var sesfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'data2.json');
var jsontext = sesfile.read().toString();
var jsondoc = JSON.parse(jsontext);

jsondoc['feedlist'].push({
    "picloc":imagename,
    "title":titlef.value,
    "desc1":descf1.value,
    "desc2":descf2.value,
    "desc3":descf3.value
    });
jsontext = JSON.stringify(jsondoc);

sesfile.write(jsontext,false);

If you are unable to locate data directory and simply want to load the file from there. (In my case it does not exist in project nor will be created with Webpreview compilings) You can do bootstrap-ish type instruction like this first

var rdfile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'data.json');
var sesfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'data2.json');
var jsontext = rdfile.read().toString();
var jsondoc = JSON.parse(jsontext);
sesfile.write(jsontext);

javascript - Cannot write to file in Titanium - Stack Overflow

javascript titanium titanium-mobile
Rectangle 27 0

You must use Google API SDK to use the geolocation on Android

javascript - Appcelerator Geolocation not working on Android - Stack O...

javascript android geolocation titanium
Rectangle 27 0

Ti.*
Titanium.*

What you can do is :

  • Create a html file within the app and load the data via ajax and use fireEvent.
titanium http client
Ti.Platform.openURL

Scripts downloaded from remote web servers cannot access the Titanium namespace.

To interact with remote content, wait until the content is loaded, then use the evalJS method to execute a JavaScript expression inside the web view and retrieve the value of an expression.

javascript - Ti.App.fireEvent not working; error Uncaught TypeError: C...

javascript android jquery titanium appcelerator
Rectangle 27 0

I've been working on this with some people over on the Appcelerator Q&A and the best answer I could come up with is a work around at best.

var clean = link.replace(/nbsp/g," ").replace(/\&/g,"").replace(/amp\;/g,"").replace(/\;/g,"");

For obvious reasons this won't work for everybody since it will wipe out all semicolons and ampersands but it worked for me. I'm perplexed as to why I can't get the entire replaced but for now I'm happy.

javascript - string.replace for Titanium webview - Stack Overflow

javascript titanium titanium-mobile ampersand
Rectangle 27 0

Titanium basically uses JavaScript for developing application in iOS and Android. If you are comfortable working in JavaScript and CSS you can try Titanium.

Its my personal opinion, try learning Objective C, its really great language. If you have knowledge of C or C++, then understanding the concepts of Objective C becomes easier.

Thanks a lot for your advise. :)

iphone - Is Titanium bugfree? and is it equally compatible for develop...

iphone ios titanium
Rectangle 27 0

Thanks for this information. I tried like this var pattern="[0-9Aa]{4}\s?[0-9Aa]{2}"; postalcodetextfield.addEventListener('invalid',function(e){ while(postalcodetextfield.value!=pattern){ var error=Ti.UI.createLabel({text:'inavlid format:1234AA'....} win.add(error);} }); but not working

javascript - Titanium Ipad: How to restrict the textbox to allow speci...

javascript titanium-mobile
Rectangle 27 0

function loop () {
    call();   
    if (keepGoing) {
        setTimeout(loop, 3000);
    }
}
loop();

BTW, why the following code won't work is a popular question on interviews (I was asked that several times).

var keepGoing;
do { setInterval(call, 3000); } while (keepGoing);

The trick is, function passed into setInterval here will be called sometimes after 3s, but only if main thread will be free. And it never will be free - it's doing infinite loop.

javascript - do while loop not working properly in Titanium - Stack Ov...

javascript titanium titanium-alloy
Rectangle 27 0

The Android environment appears to be less forgiving than the IOS environment when working with Titanium. Often, after I've written my app to work for IOS, I then need to fix it to work on Android. On the positive side, these always appear to be actual errors that I guess the IOS environment either assists with or doesn't find critical enough to stop the program execution. When I fix the code to work for Andriod, it almost always works for IOS as well with the need for branching.

Just because your code is working on IOS doesn't mean you don't have a bug in it. I find that the Android debugging process helps me strengthen the quality of my app as a whole. Don't ignore the error on the Android side at [1,69], there is likely an issue there. Perhaps an unassigned variable or a null object.

javascript - titanium android runtime error box always shows wrong lin...

javascript android titanium titanium-mobile appcelerator