I need a way to plot realtime data on a graph without blocking the UI thread. Reading several posts and articles I have understood that threads aren't the best choice to perform long works (it's an indeterminate update so it could take more than 3-4 minutes). So, what should I use? Thank You in advance.
Asked
Active
Viewed 36 times
1 Answers
1
If your long task will run while your Activity is running, then you can use an AsyncTask. Else you can use a Service

antonio
- 18,044
- 4
- 45
- 61
-
I think I will use a Service but how can I access to the UI thread from the service to update the chart? Bcause I have also read that views should be managed in the UI thread while other computations should be done in a separate thread or in this case in a service – gymni f Jun 20 '16 at 20:48
-
You can start an Activity from a Service http://stackoverflow.com/questions/3456034/how-to-start-an-activity-from-a-service – antonio Jun 20 '16 at 20:55