I have a Service running in background with a timed event. Every 5 minutes I want to download a new list of data and update an arrayadapter (used for an AutoComplete Textview box in the main Activity). How do i do this? Or if this is not doable from a Service?
I tried making the textView public static and setting an adapter directly but the program crashes saying that line cannot be done from a “thread that did not call Looper.prepare”
Thanks.
The error that you are getting is because you are trying to update the UI from a NON-UI thread. Try to use
runOnUiThread(), put the stuff to update the UI inside therunOnUiThread().UPDATE
If you are updating in service you should use the context instead of Activity_name.