On Wed, Apr 11, 2012 at 2:59 AM, Lindsay Mathieson <
[email protected]> wrote:

> And kinda wondering whats the point - "public IBinder onBind(Intent arg0)"
> is essentially being used to retrun a reference to the service class so its
> methods can be called directly by the activity. Why not just store a
> reference to the Service in a static global and have the Activity call that
> directly - it would seem much easier.


The system can kill your Service instance at any time if it needs memory,
which would suck quite bad if you had a global reference to it. But if you
bind to it, via the provided API, it tells the system "hey, I'm using this
thingy, please don't kill it from under me. k thx bye".

(This is mostly a guess from my understanding how Android works. Someone
can correct me if I'm wrong.)

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to