threading in titanium without alloy
the following code is a loop which I have to run which will update my UI
with the correct meta data title of a song currently played on the radio.
I need the loop to run every 10 seconds-ish. I tried setting a timeout of
ten seconds and calling my function every ten seconds and that caused my
app to crash so I think I have to create a seperate thread. I saw a q & a
answer detailing how to do this with alloy here:
http://developer.appcelerator.com/question/117199/how-to-create-multithreading-in-mobile-sdk
Is there any examples of doing this without alloy or what is the best
practise for implementing multiple threads? Code below:
function FetchMetaData () {
//while (true)
alert("Am I being fired");
if (isPlaying && Titanium.Network.online) {
if (TitleLabel.text !== streamer.getMetaTitle()) {
TitleLabel.setText(streamer.getMetaTitle());
}
else {
//Do nothing
}
}
else {
//Do nothing
}
//}
}
No comments:
Post a Comment