nicolas2k / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
1 stars 0 forks source link

OnItemSelectedListener.onItemSelected is not called after CardScrollView.setSelection #348

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load cards into a CardScrollView
2. Override OnItemSelectedListener (haven't tested if this is required)
3. Put a breakpoint in OnItemSelectedListener.onItemSelected 
4. Call CardScrollView.setSelection

What is the expected output? What do you see instead?
I expect my breakpoint to be hit. It is not.

What version of the product are you using? On what operating system?
XE12

Please provide any additional information below.

Original issue reported on code.google.com by eug...@wearableintelligence.com on 8 Jan 2014 at 10:56

GoogleCodeExporter commented 8 years ago
Here's another observation:

I created a descendant of CardScrollView. From its constructor, I do...
        setOnItemSelectedListener(myItemSelectedListener); // myItemSelectedListener is NOT null
        OnItemSelectedListener listener = getOnItemSelectedListener();

listener is null...

Original comment by eug...@wearableintelligence.com on 8 Jan 2014 at 11:14

GoogleCodeExporter commented 8 years ago
This does seem inconsistent with other subclasses of AdapterView, which do fire 
listeners for programmatic selection changes. For now, the best workaround 
would be to factor out the code that handles the selection into a separate 
method and manually call it after calling setSelection.

Original comment by allev...@google.com on 9 Jan 2014 at 4:46

GoogleCodeExporter commented 8 years ago
After testing, I've been unable to duplicate this. onItemSelected does get 
called when I call setSelection, whether I use a subclass of CardScrollView 
that sets the listener in its constructor, or if I use CardScrollView itself 
and set it outside. Can you provide some more code so that we can see if 
there's anything else that might be wrong?

Original comment by allev...@google.com on 9 Jan 2014 at 5:05

GoogleCodeExporter commented 8 years ago
Are you testing xe12?

Original comment by eug...@wearableintelligence.com on 9 Jan 2014 at 5:10

GoogleCodeExporter commented 8 years ago
Yes. Can you post more context around where you're creating and setting up the 
card scroller?

Original comment by allev...@google.com on 9 Jan 2014 at 5:38

GoogleCodeExporter commented 8 years ago
My bad! I overrode setOnItemSelectedListener

Original comment by eug...@wearableintelligence.com on 9 Jan 2014 at 6:18

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
You can close the issue

Original comment by eug...@wearableintelligence.com on 9 Jan 2014 at 6:34

GoogleCodeExporter commented 8 years ago

Original comment by ala...@google.com on 4 Feb 2014 at 12:18