I tried that, but AbsSpinner#setAdapter makes use of package private
fields and methods of its super classes which I don't have access to.
I even tried creating my subclass in the same package (android.widget)
but to no avail.

Is the shipped SDK doing something to specifically hide fields and
methods like AdapterView#mOldItemCount and
AdapterView#setselectedPositionInt in 2.1 and 2.2?


On Aug 22, 8:03 pm, Mark Murphy <[email protected]> wrote:
> On Sun, Aug 22, 2010 at 5:52 AM, William Ferguson
>
>
>
> <[email protected]> wrote:
> > It all hinges on the code in AbsSpinner#setAdapter
>
> > if (mAdapter != null) {
> >  ...
> >  mItemCount = mAdapater.getCount();
> >  int position = mItemCount > 0 ? 0 : INVALID_POSITION;
>
> >  setSelectedPositionInt(position);
> >  setNextSelectedPositionInt(position);
> >  ...
> > }
>
> > which selects the first element in the Adapter when the Adapter is
> > set. But if it was
>
> > if (mAdapter != null) {
> >  ...
> >  mItemCount = mAdapater.getCount();
> >  int position = INVALID_POSITION;
>
> >  setSelectedPositionInt(position);
> >  setNextSelectedPositionInt(position);
> >  ...
> > }
>
> > then initial selection of the Spinner would be configurable instead of
> > always being the first element.
>
> Subclass Spinner, override setAdapter() to behave how you want, and use it.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to