pickerWheel:selectValue() works on Simulator but says "attempt to call a nil value" on device.

Hello,

As the title says, on Simulator (Windows 7) my code works fine. I have a simple line of 

pickerWheel:selectValue( 1, 3 )

Which works fine on simulator. But on device I get:

test.lua:139 attempt to call method ‘selectValue’ (a nil value)

I tried searching Google but couldn’t find any similar results. Which is weird because I also tested on other devices.

My Corona Simulator says it’s version 2016.2992

Please help me with this…

Damn, this was quick, I should have looked harder. But, not just my fault, Brent Sorrentino promised to update the documentation but never did :smiley:

https://forums.coronalabs.com/topic/66608-picker-wheel-does-not-work-in-android/

this is because resizable pickers do  not  work with “legacy” Android widget themes. That is reflected in the console log, but I don’t blame you for not looking there. I will add a warning on this to the documentation soon.

 

So basically, because the legacy theme is being chosen by default on Android, you need to explicitly set a more modern “holo” theme, either light or dark, if you want to use resizable pickers (fixed-size pickers can still use the legacy theme).

 

 

  1. widget.setTheme( “widget_theme_android_holo_dark” )
  2. – OR…
  3. widget.setTheme( “widget_theme_android_holo_light” )

It’s actually in the docs and has been for awhile. :slight_smile:

https://docs.coronalabs.com/api/library/widget/newPickerWheel.html#resizable-construction

Brent

Oh my god I’m blind, so sorry. Good job! :slight_smile:

Damn, this was quick, I should have looked harder. But, not just my fault, Brent Sorrentino promised to update the documentation but never did :smiley:

https://forums.coronalabs.com/topic/66608-picker-wheel-does-not-work-in-android/

this is because resizable pickers do  not  work with “legacy” Android widget themes. That is reflected in the console log, but I don’t blame you for not looking there. I will add a warning on this to the documentation soon.

 

So basically, because the legacy theme is being chosen by default on Android, you need to explicitly set a more modern “holo” theme, either light or dark, if you want to use resizable pickers (fixed-size pickers can still use the legacy theme).

 

 

  1. widget.setTheme( “widget_theme_android_holo_dark” )
  2. – OR…
  3. widget.setTheme( “widget_theme_android_holo_light” )

It’s actually in the docs and has been for awhile. :slight_smile:

https://docs.coronalabs.com/api/library/widget/newPickerWheel.html#resizable-construction

Brent

Oh my god I’m blind, so sorry. Good job! :slight_smile: