Hi, have made a little progress over the last week but am still experiencing forced closes
Have narrowed it down a little to the following two subs and the error codes below.
the scenario is the app reads an sql database and based in the choice user makes loads a series of thumbnails.
the user clicks on a thumbnail and it scales to full size within a scroll panel
the error occurs when the user clicks the full size image - at this point the panel is cleared and the series of thumbnails is reloaded - currently am testing with one thumnail expanding to one full size image and then going back to one thumnail - it is at this point the program fails
the error codes appear to indicate that there is a problem with the way I am handling the loading and reloading of both the image and the thumbnail - am I on the right lines - Many thanks
SUBS:
Sub addthumbs(datab, dataa)
Dim cursor1 As Cursor
databholder = datab
dataaholder = dataa
Log(datab & " " & dataa)
Dim foldera As String
Dim c As Int
Dim T As Int
Dim L As Int
T = 15
L = 15
cursor1 = sql1.ExecQuery2("select Manual, Section, Page from Items where Manual = ? and Section = ?", Array As String(datab, dataa))
c = cursor1.RowCount
Dim thumb(c) As ImageView
If cursor1.RowCount=0 Then
Log("no manuals selected")
cursor1.Close
End If
If cursor1.RowCount > 0 Then
For i = 0 To cursor1.RowCount -1
thumb(i).Initialize("thumbclick")
cursor1.Position=i
manuala = cursor1.GetString("Manual")
manuala = manuala.Replace(" ","_")
sectiona = cursor1.GetString("Section")
sectiona = sectiona.Replace(" ","_")
page = cursor1.GetString("Page")
page=page.Replace(" ","_")
foldera = manuala & "/" & sectiona & "/" & page & ".jpeg"
Log(foldera)
'Panel2.AddView(thumb(i),L,5,675,1000)
Panel2.AddView(thumb(i),L,T,135,200)
Log(File.DirRootExternal&"/docbrowser/"&foldera)
thumb(i).Bitmap = LoadBitmap(File.DirRootExternal & "/docbrowser", foldera)
thumb(i).Gravity = Gravity.FILL
If L > 600 Then
L = 5
T = T + 210
Else
L = L + 145
End If
Next
cursor1.close
End If
End Sub
Sub thumbclick_click
Dim tc As ImageView
Dim sv As ScrollView
Dim pn As Panel
clearpanel2
If thumbflag = 0 Then
addthumbs(databholder,dataaholder)
thumbflag = 1
Return
End If
If thumbflag = 1 Then
sv.Initialize(1115)
pn = sv.Panel
sv.BringToFront
pn.BringToFront
tc = Sender
Panel2.AddView(sv,0,0,750,470)
pn.AddView(tc,5,5,750,1110)
thumbflag = 0
End If
End Sub
ERROR CODES:
threadid=1: stack overflow on call to Ljava/lang/reflect/Field;.<init>:VLLLI
method requires 24+20+4=48 bytes, fp is 0x42089318 (24 left)
expanding stack end (0x42089300 to 0x42089000)
Shrank stack (to 0x42089300, curFrame is 0x4208ba50)
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x4001d840)
GC_FOR_MALLOC freed 3457 objects / 342056 bytes in 22ms
FATAL EXCEPTION: main
java.lang.StackOverflowError
at java.lang.reflect.Field.<init>(Field.java:85)
at java.lang.reflect.ReflectionAccessImpl.clone(ReflectionAccessImpl.java:42)
at java.lang.ClassCache.deepCopy(ClassCache.java:530)
at java.lang.Class.getDeclaredFields(Class.java:710)
at anywheresoftware.b4a.BA.TypeToString(BA.java:423)
at harlech.docbrowser.main$_node.toString(main.java:215)
FATAL EXCEPTION: main
java.lang.StackOverflowError
java.lang.OutOfMemoryError: bitmap size exceeds VM budget