I am basing an audioplayer off an old tutorial, and I am seeing some
major lag in my UI, which is making me think that the threading is not
being handled properly. It is structured as such:
public void startStreaming() throws IOException {
final String mediaUrl =
currentTrackData.get("play_url").toString();
Runnable r = new Runnable() {
public void run() {
try {
downloadAudioIncrement(mediaUrl);
} catch (IOException e) {
Log.e(getClass().getName(), "Unable to initialize the
MediaPlayer for fileUrl=" + mediaUrl, e);
return;
}
}
};
new Thread(r).start();
}
public void downloadAudioIncrement(String mediaUrl) throws
IOException {
//do audio downloading and buffering in here in here
//there is not threading logic in here at all
}
I've ommitted the specific downloading code for brevity. Does calling
a function from a runnable mean that the logic will be run off the
main UI thread?
I can provide more specifics if need be. Thanks
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en