Xamarin.Forms.Picker Class Causes App Crash on Android

We took the C# Picker class example from https://developer.xamarin.com/api/type/Xamarin.Forms.Picker/ and are experiencing a crash on Android (Kitkat and Lollipop builds) - This works fine on IOS

To reproduce the crash, in the picker UI if you hold on the item above or below the selected item you get an UnhandledException. Here is the stack trace:
An unhandled exception occured.

09-30 10:51:52.866 E/AndroidRuntime(24505): FATAL EXCEPTION: main
09-30 10:51:52.866 E/AndroidRuntime(24505): Process: PickerTestXam.Droid, PID: 24505
09-30 10:51:52.866 E/AndroidRuntime(24505): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.widget.ImageButton.isShown()' on a null object reference
09-30 10:51:52.866 E/AndroidRuntime(24505): at android.widget.NumberPicker$ChangeCurrentByOneFromLongPressCommand.run(NumberPicker.java:2267)
09-30 10:51:52.866 E/AndroidRuntime(24505): at android.os.Handler.handleCallback(Handler.java:739)
09-30 10:51:52.866 E/AndroidRuntime(24505): at android.os.Handler.dispatchMessage(Handler.java:95)
09-30 10:51:52.866 E/AndroidRuntime(24505): at android.os.Looper.loop(Looper.java:145)
09-30 10:51:52.866 E/AndroidRuntime(24505): at android.app.ActivityThread.main(ActivityThread.java:5972)
09-30 10:51:52.866 E/AndroidRuntime(24505): at java.lang.reflect.Method.invoke(Native Method)
09-30 10:51:52.866 E/AndroidRuntime(24505): at java.lang.reflect.Method.invoke(Method.java:372)
09-30 10:51:52.866 E/AndroidRuntime(24505): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
09-30 10:51:52.866 E/AndroidRuntime(24505): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

We are using Xamarin Forms v1.5

Any help is appreciated

Thanks,
Alan

Tagged:

Posts

  • JesKirkupJesKirkup GBUniversity

    Same issue for me. Is there any workaround for this?

    Help would appreciated here too.

    Thanks

    Jes

  • Marc.3202Marc.3202 USMember

    Also having the same problem

  • batmacibatmaci ✭✭✭✭✭ DEMember ✭✭✭✭✭
    Does it happen on Android 4 for you all? For me i get it only for Android 4 it work higher Versions fine
  • JimmyGarridoJimmyGarrido Xamurai USXamarin Team Xamurai

    @batmaci The original issue in this thread was for an older version of Forms so the crash you are experiencing now may be a different issue. Can you file a new bug report with as much detail possible and a minimal reproruction case so we can look into it? Thanks!

  • batmacibatmaci ✭✭✭✭✭ DEMember ✭✭✭✭✭

    @JimmyGarrido I figured that out finally. it was indeed nothing to do with the picker but it was caused by UserDialogs i was raising after picker was selected. and it occurs only on android 4. currently preparing a repo for it to report.

Sign In or Register to comment.