You can actually stop default selection with a little hackery:

http://stackoverflow.com/questions/867518/how-to-make-an-android-spinner-with-initial-text-select-one


This isn't entirely future-safe because it uses method reflection and
changes the visibility at runtime, but I can attest that it works.
The other less hackish way to get around this is to just set a flag on
initializing the spinner such that you ignore the default call to
onSelectionChange(); The default will
still be displayed but it won't trigger whatever action you call from
onSelectionChange(); A third option is to inject a blank value into
your adapter. This is pretty easy with an ArrayAdapter and I do with
with a CursorAdapter using CursorWrapper

Jonathan


On Jan 25, 1:19 am, Mark Murphy <mmur...@commonsware.com> wrote:
> You cannot stop default selection, other than to set your own
> selection. IMHO, the selection event of a Spinner should not trigger
> startActivity().
>
> On Tue, Jan 25, 2011 at 9:10 AM, J@n$ <janedevana...@gmail.com> wrote:
> > I have a problem in selecting the vaues from the spinner.whenever i
> > run the programit goes to second page instead of displaying the main
> > page which has spinner.i knew the problem is due to default selection
> > of spinner values. do any one knw how stop default selection
>
> > --
> > 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
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in London:http://bit.ly/smand1andhttp://bit.ly/smand2

-- 
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

Reply via email to