I have an android app widget that gets some information from the internet when it is first launched.
More precisely it launches a service that asynchronously does a network call. At the end of that network call, in the UI thread it updates the remoteview for the widget with new information.
Touching particular parts of the widget loads an activity which does check to see if the network call stored anything, but that is a conditional statement based on the size of the network call response, if that object doesn't contain the right things then it won't load that.
My problem is that touching the widget doesn't seem to load the activity UNTIL the asynchronous network call finishes. And this doesn't make since to me because that is a separate thread.
There never seems to be a circumstance where my activity gets to even check the condition for an empty object. Instead, I touch the widget, and that seems to be put into a queue, so when the network call finishes it then loads my activity and displays information about that network call.
Why is this happening? Is it something about how I update my remoteView? My views have listeners on them from when they are first placed on the launcher screen in the onUpdate
method of the widget. Thanks