Appcelerator - Android Picker not retaining selected value
<p>Consider the following code below:</p>

<pre><code>function doClick(e) {
    win.open();
}

var picker = null;
var backBtn = null;
var selectedIdx = 0;

$.index.open();

var win = Titanium.UI.createWindow({
    exitOnClose : false,
    navBarHidden : true
});

win.addEventListener("open", function() {

    if(null != picker) {
        //picker.setSelectedRow(0, selectedIdx, false);
        return;
    }

    picker = Titanium.UI.createPicker({
        width : "75%",
        height : "50dip",
        selectionIndicator : true
    });

    picker.addEventListener("change", function(id) {
        selectedIdx = id.rowIndex;
    });

    var arr = [];
    for(var i = 0; i &lt; 10; i++) {
        arr.push(Titanium.UI.createPickerRow({
            title : i,
            color : "black"
        }));
    }

    selectedIdx = 0;

    picker.add(arr);

    backBtn = Titanium.UI.createButton({
        bottom : "10dip",
        title : "Close"
    });
    backBtn.addEventListener("click", function() {
        win.close();
    });

    win.add(picker);
    win.add(backBtn);
});
</code></pre>

<p>If the above code is executed with SDK 5.2.0.GA or 5.2.2.GA, then you will see that the picker value is not being retained. After ever open/close of the window, even if we reuse the old picker object. But, if you uncomment the setSelectedRow (hack code I would say), then it behaves as required.</p>

<p>Anyone faced such issue or is aware of a proper solution or root cause for it.</p>