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/commonsguy http://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

