Android Question Out of memory error

jayel

Active Member
Licensed User
Longtime User
Hello,

I get this error when I want to load 3 pictures in 3 different imageviews...
B4X:
Sub CreatePanel( number As Int) As Panel
    Dim pan As Panel
    Dim pi As PanelInfo
   
    pi.Initialize
    pi.LayoutLoaded = False
    pi.PanelType = 1

    pan.Initialize("")
   
    Dim lab As Label
    Dim img As BetterImageView
    img.Initialize("img")
   
    img.Tag = number
    img.ScaleType = myImgChoose.SCALETYPE_FIT_CENTER
    'img.Width = 200dip
    'img.Height = 200dip
   
   
    pan.AddView(img,0,0,FILL_PARENT,FILL_PARENT)
    Log("nummer : " & number)
    Dim myimagefile = Starter.orderheaderselect.id & "_foto_" & number & ".jpg"
    Dim mypic As Bitmap
    Log(img.Height & " - " & img.Width)
    If File.Exists(imageFolder, myimagefile) Then
        'Log(myImgChoose.Width)
        mypic = LoadBitmapSample(imageFolder, myimagefile,img.Width,img.height)
        Dim b As BitmapPlus
   
        Dim newimage As Bitmap = b.createScaledBitmap(mypic,mypic.Width/2, mypic.Height/2,True)
        img.Bitmap = b.Rotate(newimage,newimage.Width, newimage.Height,90,True)
       
        'myImgChoose.Bitmap = lastPicture 'RotateBitmap90(lastPicture)
    
    Else
        img.Bitmap = LoadBitmap(File.DirAssets,"no-image.png")
    End If
    img.Gravity = Bit.Or(Gravity.CENTER, Gravity.FILL)
   
   
   
'            pan.Color = Colors.RGB(Rnd(0, 150), Rnd(0,150), Rnd(0,150))
'            lab.Initialize("")
'            lab.Text = Title
'            lab.TextSize = 16
'            lab.Gravity = Gravity.CENTER
'            pan.AddView(lab, 0, 0, FILL_PARENT, FILL_PARENT)
       

   
    pan.Tag = pi
    Return pan
End Sub

Why?

greets John
 

jayel

Active Member
Licensed User
Longtime User
don't know....
The betterimageview is loaded in code, It has to fill the panel...
Is that the problem?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…