Java – looks like java internal static classes, but apparently not (I don’t understand, how is this possible?). )

looks like java internal static classes, but apparently not (I don’t understand, how is this possible?). )… here is a solution to the problem.

looks like java internal static classes, but apparently not (I don’t understand, how is this possible?). )

Come from:
http://developer.android.com/resources/tutorials/views/hello-gridview.html , in the ImageAdapter class:

imageView.setLayoutParams(new GridView.LayoutParams(85, 85));

Check out the new GridView.LayoutParams section. LayoutParams appears to be an internal static class of the GridView class, but according to the android documentation, the full path to the GridView class is android.widget.GridView, while LayoutParams is android.widget.AbsListView.LayoutParams is strongly >. So LayoutParams is not an internal static class of the GridView.

How is this possible?

Citations:
GridView class from android doc

LayoutParams class from android doc

Solution

Something like this:

class BaseOuter {
   static class BaseInner {
   }
}

class SubOuter extends BaseOuter {
}

public class Test {
    public static void main(String[] args) {
        SubOuter.BaseInner x = new SubOuter.BaseInner();
    }
}

For clarity, I might suggest using a “canonical” way to refer to nested types instead (hence BaseOuter.BaseInner in my example).

Related Problems and Solutions