I am creating an iPhone/Android app in Titanium. I have 2 js files
1. app.js 2.rss.js
In app.js i have written the following code :-
if(Titanium.Platform.name != 'android'){
var rssWindow = Titanium.UI.createWindow(
{
url : "rss.js",
title : "RSS FEEDS",
barColor:'#0f0f0f',
backgroundImage:'images/Background.png'
});
navigation.open(rssWindow,{animated:true});
}
else{
var intent = Ti.Android.createIntent({
url: 'rss.js',
});
intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
Ti.Android.currentActivity.startActivity(intent);
}
This code takes me to rss.js correctly but in rss.js when i try to set the background image of the current window, the app crashes while running in Android whereas it runs correctly in Iphone.
rss.js
if(Titanium.Platform.name == 'android')
var activity = Ti.Android.currentActivity;
var win = Titanium.UI.currentWindow;
Titanium.API.info('RSS screen loaded');
win.backgroundImage = 'images/Background.png'
Does anyone has a solution to this problem or am i doing something wrong.
Image path has been checked and its correct.
I haven’t checked my application on i-phone but yes, i was facing similar unexpected closing problem in my app too..
And the problem is related to setting background property of Window in Titanium..
This property works fine up to
titanium sdk 1.7.5 *but after that it crashes.
I just tired a trick to work around setting the image as background..
Just created the View
and added this to window before all my controls, that are to be displayed on window.
and the result looks the same as what was required..