I'm trying to refactor/redesign an Android app. Currently, I've one UI activity (Activity 1
) that creates a DataThread
. This thread is responsible for network I/O and interacts (provides data) with the UI activity via a handler
.
Now, I want to add another activity (a new UI screen with Video) - Activity 2
. Activity 1
is still the main activity. Activity 2
will be invoked when the user clicks a button on Activity 1
. Activity 2
's data also comes from the DataThread
.
My idea is to put the logic of my DataThread
inside an Android Service
(DataService
). My question is - can more than on activity bind to my DataService
at the same time? Is there a way to tell the service to provide data to a specific activity only?
Any other ideas are welcome?
Thanks in advance.