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?
UPDATE:
The static modifiers have been removed from the documentation.
Advertisement
Answer
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 {
// ...
}
}