Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Dirk Bruere at NeoPax Newsgroups: comp.lang.java.programmer Subject: Threads and UI in Android Date: Sun, 03 Apr 2011 19:16:52 +0100 Organization: Dirk Bruere at Neopax Lines: 20 Message-ID: <8vrrsdF6urU1@mid.individual.net> Reply-To: dirk.bruere@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net SH+JfBjkrKGmkH6EXrYyGQhg+9qa/FPa4xXnRbpVO/pJUne/Vb Cancel-Lock: sha1:0PieDASBZtbtAKlcChn5ke5dXPM= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2809 Part of the problem I have been having with adding data to a listview stems from the threads I have running. Specifically, I have a thread that constantly checks for messages coming over the Wifi/LAN. When it finds one it loads the datagram, then calls a static method from a class BlinkAPI which calls other BlinkAPI methods which loads the data into arrays. So far so good - no problems. However, if the Android ListView in the UI is to be updated with this data there is a problem. I cannot go in and do stuff to the ListView from BlinkAPI or I get a message about "called from wrong thread". Given that loading up Listviews, adapters etc should be done from the same UI thread, how best to put a "break" between my LAN thread and the UI thread? -- Dirk http://www.neopax.com/technomage/ - My new book - Magick and Technology