Error using SaveCSV

splatt

Active Member
Licensed User
Longtime User
I'm trying to write some persistant values to a CSV file:

B4X:
Sub SaveValues
   Dim su As StringUtils
   Dim table As List
   Try
      table.Initialize
      table.AddAll(Array As String("ExtDir",ExtPegDir))
      table.AddAll(Array As String("CatFile",PegSet))
      table.AddAll(Array As String("BGDir",ExtBGDir))
      table.AddAll(Array As String("BGFile",CurrentBG))
      table.AddAll(Array As String("Side",LeftOrRight))
      su.SaveCSV(File.DirRootExternal&"/Android/data/encoded.b4a/files", "encoded.csv", ",", table)
   Catch
      Log("SaveValues - "&LastException.Message)
   End Try
End Sub

I'm getting this error:
SaveValues - java.lang.ClassCastException: java.lang.String

The values I'm adding are these:
ExtDir - /mnt/sdcard/Android/data/encoded.b4a/files/encoded/Alternate Pegs/Numbers
CatFile - Numbers.cat
BGDir - ""
BGFile - wood_grain.gif
Side - Right

Any suggestions as to what may be causing the cast error?
 

splatt

Active Member
Licensed User
Longtime User
I have rewritten my SaveValues and ReadValues routines using Maps. These work very well.

However, I would still like to try and resolve the cast error above, as I have tried using SaveCSV a few times now and have always had the same problem.

Any advice greatly appreciated.
 
Upvote 0

rayzrocket

Member
Licensed User
Longtime User
i get the same error, here is the LogCat

The list that needs to be written to a csv file is in a module named FService.

Code:
Dim su As StringUtils 'in future use CSV2 that includes a settings header line(from a list)
su.SaveCSV(DumFolder,DumFile,",",FService.DataSetService) 'adds .csv to make a new file
ToastMessageShow("Data Saved To .csv File", False)

LogCat:
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…