nicolas2k / google-glass-api

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

CardScrollView throws NullPointerException #354

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm trying to get one of the cards. After a few calls of normal operation, I 
start getting an exception on every call. Not sure why. My cards are loaded 
only once - in the beginning.

01-10 12:02:23.742    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ 
java.lang.NullPointerException
01-10 12:02:23.742    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.google.android.glass.widget.CardScrollView.getCard(CardScrollView.java:1196)
01-10 12:02:23.742    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.google.android.glass.widget.CardScrollView.getItemViewForChildAt(CardScrollV
iew.java:1498)
01-10 12:02:23.742    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.xxxxxx.xxxxx.XYZCardScrollView.getCardId(XYZCardScrollView.java:66)
01-10 12:02:23.750    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.xxxxxx.xxxxx.XYZCardScrollView.pauseTrackingUsage(XYZCardScrollView.java:110
)
01-10 12:02:23.750    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.xxxxxx.xxxxx.XYZCardScrollView.access$000(XYZCardScrollView.java:20)
01-10 12:02:23.750    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.xxxxxx.xxxxx.XYZCardScrollView$1.onItemSelected(XYZCardScrollView.java:32)
01-10 12:02:23.750    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.wearableintelligence.ui.SimpleCardScrollView$OnItemSelectedListenerToFixWebV
iews.onItemSelected(SimpleCardScrollView.java:56)
01-10 12:02:23.757    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.google.android.glass.widget.CardScrollView.onSettledInternal(CardScrollView.
java:637)
01-10 12:02:23.757    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.google.android.glass.widget.CardScrollView.access$1100(CardScrollView.java:7
0)
01-10 12:02:23.757    3245-3245/com.xxxxxx.xxxxx W/System.err﹕ at 
com.google.android.glass.widget.CardScrollView$2.setItem(CardScrollView.java:266
)

This is XE12

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

GoogleCodeExporter commented 8 years ago
Since I'm using CardScrollView in conjunction with a CardScrollAdapter, I 
decided to bypass CardScrollView. getItemViewForChildAt and call 
CardScrollAdapter.getView instead. Works like a charm.

I am still puzzled why CardScrollView would break in such a trivial place. I 
look forward to getting the fix.

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

GoogleCodeExporter commented 8 years ago
Hello,

Thanks for the report! Could you share some code with us so we can try to 
reproduce? That will make it easier for us to track the issue down and fix it.

Thanks!
Alain

Original comment by ala...@google.com on 13 Jan 2014 at 4:52

GoogleCodeExporter commented 8 years ago
Closing this bug as "obsolete" as you managed to find a workaround. Please 
re-open if you are still able to reproduce: sharing some sample code would 
greatly  help us track the issue down as well.

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

GoogleCodeExporter commented 8 years ago
For the record, the error occurs periodically and while the list of cards 
doesn't change.

targetContainerView.getItemViewForChildAt throws NullPointerException, while
targetContainerView.getAdapter().getView(position, targetContainerView, 
(ViewGroup)targetContainerView.getParent()) returns the correct result

Original comment by eug...@wearableintelligence.com on 19 Feb 2014 at 7:56