blazsolar / HorizontalPicker

Android widget allowing user to select one item from set of them by swiping left and right.
http://blaz.solar/HorizontalPicker
Apache License 2.0
227 stars 81 forks source link

Invisibility problem with android 4.0.4 Tablet #14

Closed ahmetkucuk closed 9 years ago

ahmetkucuk commented 9 years ago

HorizontalPicker is not visible in the screen however when i touched the screen where HorizontalPicker suppose to be onItemClicked and onItemSelected methods are called. When i run it on Android L (Nexus 4) it is visible.

gregorpichler commented 9 years ago

I'm having the same problem on Android Wear.

Giy0mu commented 9 years ago

Same thing on Galaxy S2 with 4.0.3. More accurately, the text is invisible. Using a color or a selector doesn't change anything.

phileo commented 9 years ago

when the text becomes invisible, I see this in the logCat:

E/libEGL: call to OpenGL ES API with no current context (Logged once per thread)
W/HardwareRenderer: EGL error EGL_BAD_SURFACE
W/HardwareRenderer: Mountain View, we've had a problem here, Switching back to software rendering

I think the disabling of hardware acceleration is related to the problem, as in my manifest I tried adding:

<activity
    android:hardwareAccelerated="false"
    ...
</activity>

and can observe this problem to happen immediately.

blazsolar commented 9 years ago

@phileo Thanks for additional informations, i'll try to look into it as soon as possible.

phileo commented 9 years ago

could this be related: https://code.google.com/p/android/issues/detail?id=37956 If so, which one of the 3 workarounds described would be most appropriate ?

phileo commented 9 years ago

found the problem! Or at least a problem which affected my project, not 100% if this is the same problem.

In my case, the listener that I registered with mOnItemSelected was doing many things, and it seems some of those things are interfering with the OpenGL thread in canvas.draw(). So, instead of calling mOnItemSelected.onItemSelected() directly, I posted it to the UI Thread. This appears to fix the invisibility issue in my case.

If you want, I can submit a pull request.

blazsolar commented 9 years ago

@phileo Thanks for digging into this issue. Pull request would be appreciated.