Forum Xamarin.Forms

Xamarin Froms TimePicker Failure

RicardoSRicardoS ESMember ✭✭✭
edited December 2019 in Xamarin.Forms

Our app has a Timepicker that until now used to work. Now it gives us this error:

Binary XML file line #20: Error inflating class android.widget.TimePicker.

As I said this used to work, but now we need either a solution or an alternative. Please.

Best regards

ManuelR

P.S.: Added a trace from the Application Output.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    From the inflateException Binanry XML error, it is typically due to using an XML Tag this is not support, non existence or plain spelling error.

    Please create a empty project, add the timePicker, run it in your device If you will get the same error?

    If you have checked this issue, please share your demo about this issue.

  • RicardoSRicardoS ESMember ✭✭✭

    @LeonLu
    I tried the same code in another project, and it works.

    The line in question is this one:

    <TimePicker x:Name="timeI" Format="HH:mm" HorizontalOptions="FillAndExpand"/>

    and that's pretty much it, the .cs file only sets the time as DateTime.Now and, when the user changes it and presses a button to confirm, get the time as:

    var startdate = new DateTime(timeI.Time.Ticks);

    I'm changing the .NET Portable profile from 4.5 259 to 111, which is the one from the working project to see its influence.

    Regards

  • RicardoSRicardoS ESMember ✭✭✭

    @RicardoS said:
    @LeonLu
    I tried the same code in another project, and it works.

    The line in question is this one:

    <TimePicker x:Name="timeI" Format="HH:mm" HorizontalOptions="FillAndExpand"/>

    and that's pretty much it, the .cs file only sets the time as DateTime.Now and, when the user changes it and presses a button to confirm, get the time as:

    var startdate = new DateTime(timeI.Time.Ticks);

    I'm changing the .NET Portable profile from 4.5 259 to 111, which is the one from the working project to see its influence.

    Regards

    ...And it failed!

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You can close your VS, then delete the bin and obj folders in all of folders, rebuild your project, if this issue is still existed.

  • RicardoSRicardoS ESMember ✭✭✭

    @LeonLu said:
    You can close your VS, then delete the bin and obj folders in all of folders, rebuild your project, if this issue is still existed.

    Nope. It's still there.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Can you share a demo about this issue?

  • RicardoSRicardoS ESMember ✭✭✭

    @LeonLu said:
    Can you share a demo about this issue?

    Unfortunately, no. I cannot reproduce this outside of the project where it happens, and said project cannot be shared, because of our company stipulations.

    Terribly sorry.

  • RicardoSRicardoS ESMember ✭✭✭
    edited December 2019

    @LeonLu , you are not going to believe this, but the picker works on this project, as long as it's not in the page it was created for originally.

    Don't know how nor why. It works in the login, but, once you introduce user & password and enter, it does not work on the next page...

    This is incredibly silly.

  • RicardoSRicardoS ESMember ✭✭✭

    Copying and pasting the entire page does not work either.

    What is going on!?

  • RicardoSRicardoS ESMember ✭✭✭

    Ok, Im' going to post the ContentPage code and see if someone can decipher what is happening.

    Any doubt, please message me.

    Regards

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Is BindablePicker a custom TimePicker? If you can not share code due to the policy, You can open a free support ticket.
    https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6

  • RicardoSRicardoS ESMember ✭✭✭

    @LeonLu said:
    Is BindablePicker a custom TimePicker?

    No, it's just a picker. Bindable properties are kinda wonky, so we found this code for a BindablePicker that works and we've been using that since. Attached file for you.

    If you can not share code due to the policy, You can open a free support ticket.
    https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6

    Thank you, @LeonLu . I will.

  • RicardoSRicardoS ESMember ✭✭✭

    Welp, I tried opening a support ticket. Unfortunately, they don't have support for Spain. Soo... yeah.

  • RicardoSRicardoS ESMember ✭✭✭
    edited December 2019

    @RicardoS said:
    Welp, I tried opening a support ticket. Unfortunately, they don't have support for Spain. Soo... yeah.

    Nvm, we've found it...

    And done. Now we wait...

Sign In or Register to comment.