On Apr 3, 3:57 am, "lee.t" <[EMAIL PROTECTED]> wrote:
> Seems there have been a lot of questions regarding the selection model
> for the spinner (ie - no OnItemClicked, only OnItemSelected listeners,
> making it difficult to use callbacks which respond to 'final' item
> selection and not every 'browsing' selection in between). Most
> proposed solutions to this involve catching key events etc... has
> anyone come up with anything better than this?
>
> As I sit here (without my eclipse IDE, so I can't try it myself :( )
> I'm wondering if it isn't possible to detect the state of the spinner
> (ie - expanded as drop-down, vs collapsed 'left-right/up-down'
> selection). I'm assuming we can do this by taking advantage of the
> 'state' methods available for the View class and the
> 'state_dropdown_showing' constant mentioned in issue 330 (are these
> applicable/supported in this instance?)
>
> Presumably we might have something like this for a Spinner object
> named 's':
>
> //         s.setOnItemSelectedListener(new
> Spinner.OnItemSelectedListener(){
> //                public void onItemSelected(AdapterView parent, View
> v,  int position, long id) {
> //                    int[] state = v.getDrawableState();
> //                     for(int i=0; i<state.length; i++){
> //                        if(state[i]==R.attr.stat_dropdown_showing){
> //                            // just bail because we want to ignore
> this 'browsing' selection...
> //                            return;
> //                        }
> //                    }
> //                    // assuming that we're not showing a dropdown,
> do callback on fired selection
> //                    // (presumably this is a 'left-right/keyup-
> keydown' selection)
> //                    doCallback();
> //                 }
> //
> //                 public void onNothingSelected(AdapterView arg0) {
> //                     // do nothing
> //                     }
> //                 });
>
> Has anybody tried this? I'd be curious to know if it might work...
> I'm assuming that there's a risk here of losing the selection we're
> actually trying to get while the dropdown is open since presumably the
> OnItemSelected event fires while the View's state has the drop-down
> showing, even for the final selection... but I think that's wouldn't
> be too difficult to overcome if the rest of it will work...
>
> Any Android wizards out there who care to comment on the idea? Am I
> out in left field or does this have a chance of working?
> Suggestions welcome...
>
> Thanks
> Todd
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to