Issue
Calling match() method returns a hash i.e. Ljava.lang.Object;@40528e70 that needs to be handled as an array in Android.
Tested on
iOS 5.1 simulator
Android Razr 2.3.5
DDMS console
07-18 00:50:15.431: I/ALERT(31085): (KrollRuntimeThread) [93,93] [Ljava.lang.Object;@40528318
07-18 00:50:15.431: I/TiAPI(31085): http://www.appcelerator.com
Repro sequence
var win = Titanium.UI.createWindow({
title: 'Main',
exitOnClose: true,
fullscreen: false,
navBarHidden: false,
backgroundColor: 'gray'
});
win.addEventListener('open', function() {
var tweet = 'blah blah blah @YouTube. http://www.appcelerator.com blah blah - Spot 1';
extractURL(tweet);
});
win.open();
function extractURL(tweet) {
var urlRegex = /(http?:\/\/[^\s]+)/g;
var URL = tweet.toString().match(urlRegex);
if (URL !== null) {
//URL found
alert( URL );
//alert( URL[0] );//Work Around
Ti.API.info( URL );
win.add(
Ti.UI.createWebView({
url: URL
})
);
} else {
alert('No URL found');
return;
}
}//extractURL
match Method
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/match
Match is actually returning an array, which is correct. Here, you as passing an array of Strings to both alert() and the url property for webview, which is causing this crash. In the docs, both of those properties should be strings, not arrays. This works in iOS as a result of some internal conversion they do. There are no plans to support arrays for the properties mentioned on the Android side.
Closing ticket as invalid, with reference to the above comments.