are you updating the UI at all in the thread? From that code, everything should be done in the background and therefore leave the main UI happy, if however you are updating the UI, either the update is taking to long outside of the thread or your updating it so often that it is locking up the UI.
However I've not performed any task like this so couldn't say if there were any specific case I might be missing. Cheers, Matt On Feb 25, 6:10 pm, Jonathan <[email protected]> wrote: > 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

