Why in Android documentation Activity classes have static modifier

Tags: , , ,

If we open android documentation we will see that Activity classes have static modifier:

public static class MainActivity extends Activity {...}

I’m used to declaring Activities without static modifier:

public class MainActivity extends Activity {...}

What is the reason behind using static modifier in Activity class declaration?


It’s Documentation bug. Sadly, they are not rare. You’d normally only use the static modifier for classes when declaring an inner class that does not need to be linked to the declaring outer class, for example:

public class OuterClass {
    // ...

    // static inner class has no reference to outer class
    public static class InnerClass { 
        // ...

Source: stackoverflow