Should the "sub"-activities in a TabActivity bind services?
<p>I am building an application based on a tabbed activity. There are about 12 tabs at any given time.</p>

<p>I have built a download service, for my own use, which requires binding to it. I've found a few questions about the issue binding Services from tabs, but I haven't found anything discussing the best way to design this.</p>

<p>My paths seem to be:</p>

<ol>
<li>Bind the download service in the tab's activities using getParent() or getApplicationContext() as the context to bind to.</li>
<li>Bind the download service once in the TabActivity and then expose it via a static method to other Activities making up the tabs.</li>
<li>Redesign the download service so that it does not require binding. (I'm not really sure this is a viable option or buys me much)</li>
</ol>

<p>I'm basically in a toss up between 1 and 2. It seems like #1 seems to make the activities more independent, but I'm not sure if its going to cause problems having the tab "sub" activities binding the same service 12 times on the tab activitie's context. Similarly, I'm not sure if it is good practice to expose state-dependent objects, like a Service, via a static method to other Activities. I'm concerned it may create a number of race conditions that need to be accounted for depending on when the binding happens and when the tab activities are started.</p>

<p>What seems like the better design?</p>
