Alternatively, you may want to use Message and Handler to do your non UI Thread work. There are quite a few examples out there about this. An excellent item that covers it (and deals with some other common issues) is Eric Burke's common thread bug article: http://www.ociweb.com/jnb/jnbJan2009.html
Also, here is an example project that uses a Thread (outside of the UI thread) to fetch data over the network: http://unlocking-android.googlecode.com/svn/chapter3/trunk/RestaurantFinder/src/com/msi/manning/restaurant/ReviewDetail.java. On Feb 22, 8:10 pm, Gray <[email protected]> wrote: > I am developing an application on the Android Platform for my music > service (axcid.org).. > > Haven't spent a huge amount of time in Java but could use a bit of > help with this code:http://pastebin.com/m5300a4e6 > > bit of bad practice in there I know but I haven't spent a ton of time > developing Java apps.. > > Anyways the problem: > if (!this.listLoaded) { > //holdup this needs it's own thread > //Url load and parse time. > > //Now we can start a thread for the search :) > Thread thread = new Thread(this); > thread.start(); > > I need update media list to be called when: > public void run() { > // search > String URL = this.getIntent().getExtras().getString("searchurl"); > sm.LoadResults(URL+"?android=1"); > listLoaded = true; > } > > is done.. > > However calling it from the thread will crash Android. Did many google > searches but found nothing. Friend told me to try here. > > How can I call updateMediaList when the thread is complete? (from the > UI thread) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

