Android Question Resumable sub return type must be resumable sub or none. none

Reminisce

Active Member
Hello all, this is my code that displays items in my panel, I want to download the items images as it is being populated,but I get the resumable subs return type must be ResumableSub or none. I know I'm doing something wrong, I need you gurus to help me find a way around this.
B4X:
Sub displayitems(itemid As Int,itemname As String,itemprice As Int, itemimage As String,width As Int,height As Int) As Panel

    Dim panel_items As Panel
    panel_items.Initialize("")

    panel_items.LoadLayout("items")

    panel_items.SetLayout(0,0,width,height)

    lblitemname.Text = itemname

    lblitemname.Tag = itemid

    lblitemprice.Text = "N"&NumberFormat(itemprice,3,3)

    lblitemprice.Tag = itemprice

    imgitem.Tag = itemimage.ToLowerCase

    lblitemname.textColor = Main.maincolour

    lblitemprice.TextColor = Main.maincolour

    btnaddtocart.TextColor = Main.maincolour

    btnaddtocart.SetColorAndBorder(Main.whitecolour,2,Main.maincolour,2)

    

    If File.Exists(File.DirInternal,imgitem.Tag) And itemimage.StartsWith("item_icon_") Then

        Dim bmp As B4XBitmap

        bmp = LoadBitmap(File.DirInternal,imgitem.Tag)

        Dim nativeme As JavaObject

        nativeme.InitializeContext

        Dim bm As Bitmap

        bm.Initialize3(bmp)

        Dim bordercolor,borderwidth As Int

        bordercolor = Main.maincolour

        borderwidth = 50

        Dim finalbmp As Bitmap = nativeme.RunMethod("getRoundBitmap",Array(bm,bordercolor, borderwidth))

        bmp = finalbmp

        imgitem.Bitmap = bmp

        

    Else

            Dim jobloaditemimage As HttpJob

            jobloaditemimage.Initialize("jobloaditemimage",Me)

            jobloaditemimage.Download(Starter.serverlink&"item/"&imgitem.Tag)

            

            Wait For (jobloaditemimage) jobdone(job As HttpJob)

            If job.Success Then



                Dim outputstream As InputStream = File.OpenOutput(File.DirInternal,imgitem.Tag,False)

                Dim inputstream As InputStream  = job.GetInputStream

                 File.Copy2(inputstream,outputstream)

                outputstream.Close

                End If

                

            Dim bmp As B4XBitmap

            bmp = LoadBitmap(File.DirInternal,imgitem.Tag)

            Dim nativeme As JavaObject

            nativeme.InitializeContext

            Dim bm As Bitmap

            bm.Initialize3(bmp)

            Dim bordercolor,borderwidth As Int

            bordercolor = Main.maincolour

            borderwidth = 50

            Dim finalbmp As Bitmap = nativeme.RunMethod("getRoundBitmap",Array(bm,bordercolor, borderwidth))

            bmp = finalbmp

            imgitem.Bitmap = bmp

    End If

            

            

    Return panel_items

    

            

End Sub
 

Reminisce

Active Member
Yeah, @Erel I saw that thread earlier on. I don't quite understand it fully. I guess I will have to move the job download code into a different sub.
 
Upvote 0
Top