Button not working on Android but working on iPhone - what's wrong?

You must Login before you can answer or comment on any questions.

Hi All. I've created a window in my app with the below button added. It is displaying fine, but it doesn't do anything - and it works fine on the iPhone Simulator where it unloads the currentwindow and opens the next. Does this work differently on Android devices?

myButton.addEventListener('click', function(e){
        myVariable1 = 0;
        myArray = [];
        myWindow.close();
        myOtherWindow.open();
        });
Thanks in advance, dearest, Louise

1 Answer

I am unable to reproduce your issue. Here's the code I used, based on your's, that works on both android and ios

var win = Ti.UI.createWindow({
    backgroundColor:'#f00'  
});
var win2 = Ti.UI.createWindow({
    backgroundColor: '#0f0' 
});
var myButton = Ti.UI.createButton({
    title:'test',
    height: '40dp',
    width: '150dp'
});
myButton.addEventListener('click', function(e){
        myVariable1 = 0;
        myArray = [];
        win.close();
        win2.open();
        });
win.add(myButton);
win.open();

Your Answer

Think you can help? Login to answer this question!