Hey guys, i made a little image gallery but I'm getting stuck trying to do it in another thread.
it goes like this:
1) I create a list and fill it with a type that has the filename, positions etc...
2) I create an array of bitmap the size of all those objects
3) I start the loading thread, this thread loops through the first list and loads a bitmap sample for each item, populating the array of bitmaps.
4) after each bitmap is loaded, I call Thread1.RunOnGui("ImageLoaded"). This simply passes the index of the image i just loaded into the array and tells the correct imageview to set that as the image...
I'm getting stuck in the middle of the thread in a strange place...
Setting Params(1) in the example below.. CurrIdx = 0 in my log.
It just highlights yellow, no errors, nothin. BL is my bitmap array. FL is my list of empty tiles waiting for images
This kind of stuff is a piece of cake downloading images from the net, but locally it gets pretty strange.
it goes like this:
1) I create a list and fill it with a type that has the filename, positions etc...
2) I create an array of bitmap the size of all those objects
3) I start the loading thread, this thread loops through the first list and loads a bitmap sample for each item, populating the array of bitmaps.
4) after each bitmap is loaded, I call Thread1.RunOnGui("ImageLoaded"). This simply passes the index of the image i just loaded into the array and tells the correct imageview to set that as the image...
I'm getting stuck in the middle of the thread in a strange place...
Setting Params(1) in the example below.. CurrIdx = 0 in my log.
It just highlights yellow, no errors, nothin. BL is my bitmap array. FL is my list of empty tiles waiting for images
B4X:
For I = 0 To FL.Size-1
Log(CurrIdx)
Dim GalObj_Folder As GALLERY_OBJ : GalObj_Folder = FL.Get(I)
LoadGalleryImage(GalObj_Folder)
BL(CurrIdx) = GalObj_Folder.Image
Dim Params(1)
Params(0) = 0
Params(1) = CurrIdx
CurrIdx = CurrIdx + 1
Dim ok As Boolean
Do Until ok
Th1.RunOnGuiThread("ImageLoaded",Params)
ok = Lk1.WaitFor(1000)
Loop
Next
This kind of stuff is a piece of cake downloading images from the net, but locally it gets pretty strange.
Last edited: