Addo Well-Known Member Licensed User Longtime User Dec 31, 2018 #1 Happy New Year every one , i have a simple issue i am trying to use the date of the phone to grab some information from a database database date is in english which means if the phone date is in arabic the client cannot grab any data from the destination i have tried to work around this because i ask this question before so i added this line of code in the service create of the app Code: Dim ju As JavaObject ju.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(ju.GetField("US"))) on some phone this works fine but sadly on phones that hold android 7 and above it does not help. the date output remains in arabic , what could be a solution in this case ? Last edited: Jan 1, 2019
Happy New Year every one , i have a simple issue i am trying to use the date of the phone to grab some information from a database database date is in english which means if the phone date is in arabic the client cannot grab any data from the destination i have tried to work around this because i ask this question before so i added this line of code in the service create of the app Code: Dim ju As JavaObject ju.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(ju.GetField("US"))) on some phone this works fine but sadly on phones that hold android 7 and above it does not help. the date output remains in arabic , what could be a solution in this case ?
Erel B4X founder Staff member Licensed User Longtime User Dec 31, 2018 #2 https://www.b4x.com/android/forum/threads/unparseable-date.75927/#post-481825 Have you added it to Service_Create of the starter service? Upvote 0
https://www.b4x.com/android/forum/threads/unparseable-date.75927/#post-481825 Have you added it to Service_Create of the starter service?
Addo Well-Known Member Licensed User Longtime User Dec 31, 2018 #3 service create i am not using starter service Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 31, 2018 #4 You can add the starter service just for this. It is very useful. Upvote 0
Addo Well-Known Member Licensed User Longtime User Dec 31, 2018 #5 i will try it out happy new year Upvote 0
Addo Well-Known Member Licensed User Longtime User Dec 31, 2018 #6 sadly on android 7 + the date is still arabic Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 1, 2019 #7 Can you upload a small program that reproduces it? Upvote 0
Addo Well-Known Member Licensed User Longtime User Jan 1, 2019 #8 sure here is it Attachments datetest.zip datetest.zip 20.6 KB · Views: 625 Upvote 0
Addo Well-Known Member Licensed User Longtime User Jan 1, 2019 #9 here is the actual problem if the app have only 1 activity , the date shows in english in arabic phones and no problems at all . But if the app has 2 activities and the date is in the secondary activity the date shows in arabic . this is another sample of the problem Attachments datetest2.zip datetest2.zip 22.1 KB · Views: 641 Last edited: Jan 1, 2019 Upvote 0
here is the actual problem if the app have only 1 activity , the date shows in english in arabic phones and no problems at all . But if the app has 2 activities and the date is in the secondary activity the date shows in arabic . this is another sample of the problem
Erel B4X founder Staff member Licensed User Longtime User Jan 1, 2019 #10 Add this sub to the starter service: Code: Sub SetLocale Dim ju As JavaObject ju.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(ju.GetField("US"))) End Sub Call it from Activity_Create of each activity: Code: CallSub(Starter, "SetLocale") Upvote 0
Add this sub to the starter service: Code: Sub SetLocale Dim ju As JavaObject ju.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(ju.GetField("US"))) End Sub Call it from Activity_Create of each activity: Code: CallSub(Starter, "SetLocale")