brucko wrote:
> As someone with not a lot of experience in things Android, the Context
> is one of the most confusing things to me and I would love to see a
> blog article/ Mark Murphy chapter specifically on each of the various
> levels of Context returned by the various methods and when they should
> be used.

???

Why on Earth would you want the President/CEO of the Green Bay Packers
to write about Contexts?

Oh, wait. You mean me.

:-)

> On the whole, I love Android, but an article on Context best practice
> (or maybe half a chapter, or Appendix table, in one of Mark Murphys
> books) is really needed so that Learner drivers like myself don't ruin
> the Android experience for everyone.

As one of the set (Crosby, Stills, Nash, Young) sorta wrote, "if you
can't be with the Context you love, love the Context you're with".

IOW, if you're in an Activity, and you need a Context, use the Activity,
because Activity inherits from Context. If you're in a Service, and you
need a Context, use the Service, because Service inherits from Context.
If you're in onReceive() of a manifest-registered BroadcastReceiver, and
you need a Context, use the one passed in as a parameter. And so on.

That covers perhaps 90% of the cases right there, IMHO.

No question, the remaining 10% is confusing. It's one of those topics
I'm scared to tangle with, mostly because of the reasons you pointed
out: it's a bunch of sometimes-contradictory rules of thumb. There are
some subjects where I can't be as definitive as I want to be -- tasks
are another fine example -- so I tend to avoid 'em. I'm just a wimp.

I'd love to be able to pick Google's collective brains on these things
(in some non-discriminatory fashion, as I'm *so* not looking for special
treatment). We need to get more advice on topics like this out there,
and I think some core Android team members and some community folk could
knock out advice for some of the icky stuff in a one-day event.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.3 Available!

-- 
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