> Yes. The more you find that you are doing this, the more you have > over-engineered your object model, IMHO.
I don't know, I would actually argue the opposite. IMHO, any object that doesn't need a Context or one of its super or subclasses, is not really targeting the Android platform. The Android specific code can obviously factored out of any class using the Strategy patttern, but I think that just complicates the design and mostly a useful exercise only for cross-platform libraries. It would also requiry violating MY first rule in an AndroidStrategy class: - I never EVER store a Context family object as a member of a class -- I always pass it as an argument. This is to avoid accidentally leaking the context. - The above is true for cases when inner classes need the context, like UI event handlers. In my app, for example, there is a CopyUI class. This CopyUI is comprised of a few dialogs -- it may prompt for a file name, or it may pop-up a warning that the file already exists and it also displays a spinner while copying. The method CopyUI.show() takes a Context, but it's never stored in a member, but instead, it is made "final" and passed around from dialog to dialog. - I always pass the most appropriate "context." For example, if I need to retrieve a string only, I only pass a Resources object. This is more a self-documentation style, than a real requirement, though. -- 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

