Android Question xcustomlist with arabic and latin dates

kohle

Active Member
Licensed User
Longtime User
Hi,
I have now my first game on google play store and I have a strange behavior
of a highscorelist, which shows the date of an other player in arabic letters.
All others are in latin characters. See my screenshot.

My cellphone is configured for : english . But why I see an arabic date ?

See screenshot

What can I do.
 

Attachments

  • 23-01-_2019_12-09-47.png
    23-01-_2019_12-09-47.png
    92.7 KB · Views: 136

kohle

Active Member
Licensed User
Longtime User
understand. here are some details. Its easy.
I make an insert into an sqlite table. The date field is a text field.
After I show it in a xcustomlistview.

Here is the code of writing :

B4X:
DateTime.DateFormat="dd.MM.yyyy"
ls_date = DateTime.Date(DateTime.Now)

ls_sql = "insert into t_score(name,rounds, date, time,difficulty,type_maze ) values('" & ls_name & "'," & Main.AddScoreValue & ", '" & ls_date & "','" & Main.actTime & "'," & Main.type_gamePara & "," & Main.type_maze  & " ) "

jk.SQL.ExecNonQuery(ls_sql)


Code of reading and showing (partial):

B4X:
    strDate = cu.GetString("date")
    ...
lvScore.Add(CreateListItem(strDiff,rounds,strName,strDate, lvScore.AsView.Width, 40dip,Colors.White), i)
...




B4X:
Sub CreateListItem(diff As String, rounds As String , name As String, date As String, Width As Int, Height As Int,color As Int) As Panel
    Dim p As Panel
    p.Initialize("")
    p.SetLayout(0, 0, Width, Height)
    p.LoadLayout("ScoreItem")
    
    lblName.Text = name
    lblName.TextColor=color
    
    lblRounds.Text=rounds
    lblRounds.textColor=color
    
    lblScoreDate.Text=date
    lblScoreDate.textColor=color
    
    lblDiff.Text=diff
    lblDiff.textColor=color
    
    
    Return p
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
ls_sql = "insert into t_score(name,rounds, date, time,difficulty,type_maze ) values('" & ls_name & "'," & Main.AddScoreValue & ", '" & ls_date & "','" & Main.actTime & "'," & Main.type_gamePara & "," & Main.type_maze & " ) "
Not good. You need to learn how to use parameterized queries. Watch the SQL video tutorial: https://b4x.com/etp.html

Where do the highscores come from? Don't they come from multiple devices?
 
Upvote 0

kohle

Active Member
Licensed User
Longtime User
yes the highscores come from multiple devices, but for what I have this :
DateTime.DateFormat="dd.MM.yyyy" ?
If I get YY.MM.DD in arabic ?

I dont understand what this has to do how I insert my text field into the table.
The problem is here :

DateTime.DateFormat="dd.MM.yyyy"
ls_date = DateTime.Date(DateTime.Now)

which dont work on multiple language devices.
 
Upvote 0

kohle

Active Member
Licensed User
Longtime User
Correction: Yes of course you are right, if there are ' in the name, like in cinese and other foreign languages . It will be a problem in my sql
I will change it. But I think the date problem is something else
 
Upvote 0
Top