Hello Guys,
I starded facing the following problem. Can anyone identify what am I doing wrong?
Line presenting the error:
Regards,
Fernando
I starded facing the following problem. Can anyone identify what am I doing wrong?
Error occurred on line: 53 (Main)
String cannot be cast to ...
String cannot be cast to ...
Line presenting the error:
B4X:
wWordEmpty.SubString2(0, wWordOK.Length - 1) ' <=== ERROR LINE 53
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Main")
Log("*** Lendo tabela inteira para lista ***")
lstWords1 = File.ReadList(File.DirAssets, "tabpalavras.txt")
lstWords2.Initialize
lstWords2.AddAll(lstWords1)
lstWords2=ShuffleList(lstWords2)
Log("LIST2 after shuffle: " &lstWords2)
Dim wLeft As Int
Dim cd As ColorDrawable
Dim wLetras As Int
Dim bg As Bitmap
wWordOK = lstWords2.Get(Rnd(0,lstWords2.Size - 1))
wWordOK = wWordOK.trim
wWordEmpty = " "
wWordEmpty.SubString2(0, wWordOK.Length - 1) ' <=== ERROR LINE 53
wWordShuffled = wWordOK
Do While wWordShuffled = wWordOK
wWordShuffled = ShuffleWord(wWordOK)
Loop
bg = LoadBitmapResize(File.DirAssets, wWordOK & ".jpg", ImageView1.Width, ImageView1.Height, True)
ImageView1.SetBackgroundImage(bg).Gravity = Gravity.CENTER
wLetras = wWordShuffled.Length
wLeft = (100%y - (wLetras * 45dip)) / (wLetras + 2)
cd.Initialize2(Colors.Black, 5dip, 3dip, Colors.Green)
DrawWord(wWordEmpty, wLeft, 250dip, True)
wLeft = (100%y - (wLetras * 45dip)) / (wLetras + 2)
cd.Initialize2(Colors.Red, 5dip, 3dip, Colors.Yellow)
DrawWord(wWordShuffled, wLeft, 400dip, False)
End Sub
Regards,
Fernando