EDIT: Both DonManfred and Sorex provided viable solutions, which can be combined together.
Hello,
I want to download a small text file hosted in my server.
http://www.ninjadynamics.com/apps/hyperblox/displaydata.txt
The current file displays the following:
I have, however, uploaded a dummy "displaydata.txt" file before, containing:
Although, I've updated the file on the server via FTP, I'm still getting the dummy file values, plus an error saying the list contains only 2 elements instead of 4, as the current file does.
Here's my code:
Is there anything wrong? Should I flush my HTTP cache? If so, how?
I have already restarted the tablet and deleted the local displaydata.txt file manually.
Hello,
I want to download a small text file hosted in my server.
http://www.ninjadynamics.com/apps/hyperblox/displaydata.txt
The current file displays the following:
B4X:
1422450000000
1422453600000
100
50
I have, however, uploaded a dummy "displaydata.txt" file before, containing:
B4X:
12345
78946
Although, I've updated the file on the server via FTP, I'm still getting the dummy file values, plus an error saying the list contains only 2 elements instead of 4, as the current file does.
Here's my code:
B4X:
Sub Globals
'Server Data
Dim GetData, GetMOTD, GetNJAD As HttpJob
Private iMOTD As ImageView
Private iNJAD As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
If File.ExternalWritable = True AND File.Exists(File.DirDefaultExternal, "displaydata.txt") Then
File.Delete(File.DirDefaultExternal, "displaydata.txt")
End If
GetData.Initialize("GetData", Me)
GetData.Download("http://www.ninjadynamics.com/apps/hyperblox/displaydata.txt")
End Sub
Sub JobDone (Job As HttpJob)
If Job.Success = True Then
Select Job.Jobname
Case "GetData"
Dim temporary_file As OutputStream
temporary_file = File.OpenOutput(File.DirDefaultExternal, "displaydata.txt", False)
File.Copy2(Job.GetInputStream, temporary_file)
temporary_file.Close
If File.ExternalWritable = True AND File.Exists(File.DirDefaultExternal, "displaydata.txt") Then
Dim server_data As List
server_data = File.ReadList(File.DirDefaultExternal, "displaydata.txt")
MOTD_ExpireDate = server_data.Get(0)
NJAD_ExpireDate = server_data.Get(1)
MOTD_ChanceRate = server_data.Get(2)
NJAD_ChanceRate = server_data.Get(4)
If MOTD_ExpireDate <> 0 Then AND DateTime.Now < MOTD_ExpireDate Then
GetMOTD.Initialize("GetMOTD", Me)
GetMOTD.Download("http://www.ninjadynamics.com/apps/hyperblox/motd.png")
End If
If NJAD_ExpireDate <> 0 Then AND DateTime.Now < NJAD_ExpireDate Then
GetNJAD.Initialize("GetNJAD", Me)
GetNJAD.Download("http://www.ninjadynamics.com/apps/hyperblox/njad.png")
End If
End If
Case "GetMOTD"
iMOTD.Bitmap = Job.GetBitmap
iMOTD.BringToFront
Case "GetNJAD"
iNJAD.Bitmap = Job.GetBitmap
iNJAD.BringToFront
End Select
Else
End If
End Sub
Is there anything wrong? Should I flush my HTTP cache? If so, how?
I have already restarted the tablet and deleted the local displaydata.txt file manually.
Last edited: