Public Sub LoadArtList (ArtContent As B4XOrderedMap)
'ARTICLE LIST CREATION (news listview)
clvNews.Clear
Private lstArt As List = ArtContent.Values
lstArt.SortType("CDate", False)
For i=0 To lstArt.Size-1
Private AI As ArtItem
AI = lstArt.Get(i)
'Private mapArt As Map = ArtContent.Get(ArtNID)
Private ArtVal As ArtValue
ArtVal.Initialize
ArtVal.ArtNID = AI.ArtNID
ArtVal.ArtTitle = AI.ArtTitle
ArtVal.ArtBody = AI.ArtBody
ArtVal.ArtImgID = AI.ArtImgID
ArtVal.ArtImgTitle = AI.ArtImgTitle
ArtVal.ArtImgAlt = AI.ArtImgAlt
ArtVal.ArtImgURL = AI.ArtImgURL
ArtVal.ArtImg = AI.ArtImg
Private imgID As Int = ArtVal.ArtImgID
Private img As Bitmap = ArtVal.ArtImg
Log ("Image ID = " & imgID & " | img.IsInitialized = " & img.IsInitialized)
ArtVal.CDate = AI.CDate 'creation date
Private pnl As B4XView = CreateItem (ArtVal)
clvNews.Add (pnl, ArtVal)
Next
clvNews.sv.ScrollViewOffsetY = 0
End Sub
Private Sub CreateItem (av As ArtValue) As B4XView
Private pnl As B4XView = xui.CreatePanel("")
pnl.SetLayoutAnimated (0,0,0,100%x, 100%y)
pnl.LoadLayout("article_itemlayout")
lblArtTitle.Text = av.ArtTitle
vwArtBody.LoadHtml(av.ArtBody)
Private aImg As Bitmap = av.ArtImg
'Private imgHeight As Int = 100%y-(lblArtTitle.Height + vwArtBody.Height)
If aImg.IsInitialized Then
'av is a type that contains all item data
'imgArticle, lblArtTitle are B4XView
'aImg is a Bitmap
'vwArtBody is a WebView
'>>> this is the line of code where the error occurs (only this line of code crashes the app, all the rest of the code runs fine):
imgArticle.SetBitmap(aImg.Resize(pnl.Width, pnl.Height-(lblArtTitle.Height + vwArtBody.Height), False))
lblImgAlt.Enabled = True
lblImgAlt.Text = av.ArtImgAlt
lblImgAlt.Visible = True
End If
Return pnl
End Sub