I have a background thread that is sending data about the application's current status to a server. The thread is supposed to constantly - or at least whenever the status changes - send this data.
The data is coming from the UI and the user is able to change the status any moment (by moving with the finger over the screen), so I need to tell the background thread to send the updated data.
Is there any Android way to do this? My solution would be to keep the thread's instance available and add some method to allow setting the thread's internal data that is to be send. However I'm not even sure if that even works (given that the thread doesn't run on the main thread where the command to update it would come from). I looked at AsyncTask before, as that seems to be the standard solution for background workers, but I didn't see anything that makes it possible to push data into that task (it only reports data/progress back to the UI thread).