That might work, though I cringe how bad an OO practice it is to
define something as the concrete class when the interface would
suffice.  Not that my opinion on OO practices really matter.

I sitll think that if an interface is not applicable for certain
operations, like the Application Context cannot be used everywhere, it
should have been a base interface just containing the usable
operations.

I have the same issue, BTW, with some of the built-in Collection
classes.  I have, at least, half dozen times, encountered issue where
I tried to modify a collection returned by Collections.singletonList()
and got an UnsupportedOperationException thrown in my face.

On Aug 10, 10:29 pm, Nikolay Elenkov <nikolay.elen...@gmail.com>
wrote:
> On Wed, Aug 10, 2011 at 11:15 PM, nadam <a...@anyro.se> wrote:
> > Renaming helps sometimes to prevent such accidents, for instance if
> > you know the task should always be created from an activity you can do
> > like this:
>
> Or have your constructor accept Application which is a Context.

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

Reply via email to