D
Dirk Bruere at NeoPax
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?
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?