theJava
theJava

Reputation: 15044

How to Preload an image in Android

var win = Ti.UI.createWindow();
var view = Ti.UI.createView();

Titanium.UI.setBackgroundImage('images/logo.png');
win.add(view);
win.open();

Once this image is loaded, i need to navigate to next page in some seconds or when the application is loaded fully... how to do it?

Upvotes: 1

Views: 1467

Answers (1)

marshall_law
marshall_law

Reputation: 511

You could try using a separate ImageView and add a listener for the "load" event, i.e.:

var imageView = Ti.UI.createImageView({ url: 'images/logo.png' });
win.add(imageView);
imageView.addEventListener("load", function(e) {
    // navigate here
});

Upvotes: 1

Related Questions