locked
Error setting TimePicker Hour property on Android RRS feed

  • Question

  • User266765 posted

    Hi,

    I'm trying to set a stored hour to a TimePicker on the OnCreate method.

    var time = dialogView.FindViewById<TimePicker> (Resource.Id.timeDialogtimePicker);

    _time.Hour = 8;

    On the simulator, it works fine, but on a real device, it shows the following exception:

    Java.Lang.NoSuchMethodError: no non-static method "Landroid/widget/TimePicker;.getHour()I"

    Any ideas if this is a Xamarin bug?

    Testing on a Moto G 1st get. OS Android 5.1

    Thank you,

    Daniel

    Wednesday, March 29, 2017 1:48 PM

All replies

  • User327871 posted

    I also have the same problem,any help?

    Friday, June 16, 2017 1:58 AM
  • User266765 posted

    Hi Gabriel, sorry for the late response, that property is Since API 23, the issue is when you target a lower API, if thats the case you have to use the CurrentHour property

    _time.CurrentHour = (Java.Lang.Integer) 8;

    It works just fine

    Thursday, June 29, 2017 3:45 PM
  • User333057 posted

    It works for me too. Thank you.

    Tuesday, July 18, 2017 10:31 AM