I work on android app in xamarin cross platform. I have problem when the application run in release mode with datepicker. If I have datepicker in view ,I can run application normally in debug mode. If I build release .apk file and install to device, the application will crash in case of setting language&input on device as Thai language (the other language e.g. English,France can run normally). I'm not sure the problem is about the B.E. format or not and how can I fix this problem thank you.
1
votes
Are you sure the Thai language is installed on the device ?
– fandro
Yes, when I run in debug mode it can run normally with thai language setting on device but not in release mode
– Weanich Sanchol
have you got the folder values and values-thai (I don't know the exact syntaxe) for your string.xml files ?
– fandro
Add some code in your question if you do some king of stuff when changing language
– fandro
sorry, I can not find string.xml in my xamarin project
– Weanich Sanchol
1 Answers
1
votes
I think the problem is that when you change the language in the device, the system Date Format does not correspond to the DateTime Format.
Try to set it in code when changing the language :
In xaml :
<DatePicker x:Name="MyDatePicker" VerticalOptions="CenterAndExpand"
Date="{x:Static sys:DateTime.Now}">
</DatePicker>
In C# :
MyDatePicker.Format = "yyyy-MM-dd";
MyDatePicker.Date = new DateTime(); // Set the date time as you want it. And remove the Date attribute in the Xml
Hope it helps