OK a better example would be: boolean mInLayout = false;
in AdapterView, this has no get or set function so it can only be accessed by classes in the same package such as Gallery with it's onLayout function: protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); /* * Remember that we are in layout to prevent more layout request from * being generated. */ mInLayout = true; layout(0, false); mInLayout = false; } I want to create a similar class to Gallery, but because my classes are not in the same package i cannot access mInLayout. even though I extend AbsSpinner and hence AdapterView, so should mInLayout be protected? If it was i could then access it and write a similar custom class to Gallery.. On Nov 30, 9:01 pm, Taf <neild...@gmail.com> wrote: > Hi, > > I was just trying to extend the AbsSpinner Class, to create my own > custom widget. But the problem is that some of the member variables > have a a default scope, so I can't access them just by extending the > class (they can only be access directly by classes in the same > package). Some are ok as they have getters and setters , but there is > the odd member variable that doesn't , so i simply can't access them > because my new custom widget in not in the same package. An example of > such a member variable is mSelectedPosition in AdapterView. > > Would it not be better if these vars were to have a protected scope > rather than the default scope, it would then be easier to extend these > classes to make custom widgets outside of the package of these > classes. -- 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