Calling the base class is required for IntentService and its subclasses
(such as Mark Murphy's WakefulIntentService).

16.07.2010 1:09 пользователь "Justin Anderson" <[email protected]>
написал:

Jake,

You haven't given enough information to determine if it should be called
before or after your stuff.  And it also depends on what the Service
constructor does (which I don't know because I haven't looked at the source.

I guess the point I am trying to make (that it totally depends and can't be
answered as generically as you want it to be) is best illustrated with an
example:

public class Foo
{
    protected int x;

    public Foo()
    {
        x = 3;
    }
}

public class Bar1 extends Foo
{
    public Bar1()
    {
        super();
        x = 5;
    }
}

public class Bar2 extends Foo
{
    public Bar2()
    {
        x = 5;
        super();
    }
}

In the example above, x will have the value 5 after the Bar1 constructor
finishes but Bar2 will have the value of 3 after the constructor
finishes....

So, as I said before, it completely depends on what the super class does and
what the subclass is doing.  I have not looked at the source code for
Service and I don't know what your subclass does so I don't know what case
works best...

TreKing's comments are certainly valid though.  From his observations it
seems that it does not matter.  And if it did matter you could certainly
just try both and see which way works, as he also suggested.

Personally, I ALWAYS call super in my subclasses... Even if it is just a
placeholder hook.

Sorry that my answer was too generic.  I couldn't be more specific with the
generic nature of your question.

----------------------------------------------------------------------


There are only 10 types of people in the world...

Those who know binary and those who don't.
----------------------------------------------------------------------




On Thu, Jul 15, 2010 at 2:47 PM, TreKing <[email protected]> wrote:
>
> On Thu, Jul 15, 2010 a...

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to