Hello,
I get this error when I want to load 3 pictures in 3 different imageviews...
Why?
greets John
I get this error when I want to load 3 pictures in 3 different imageviews...
nummer : 1
-1 - -1
nummer : 2
-1 - -1
java.lang.OutOfMemoryError: Failed to allocate a 15872268 byte allocation with 9150832 free bytes and 8MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:975)
at android.graphics.Bitmap.createBitmap(Bitmap.java:946)
at android.graphics.Bitmap.createBitmap(Bitmap.java:877)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:753)
at flm.b4a.bitmapplus.BitmapPlus.createScaledBitmap(BitmapPlus.java:60)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at be.robotronic.roboorder2.orderdetailmod.afterFirstLayout(orderdetailmod.java:102)
at be.robotronic.roboorder2.orderdetailmod.access$000(orderdetailmod.java:17)
at be.robotronic.roboorder2.orderdetailmod$WaitForLayout.run(orderdetailmod.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
** Activity (orderdetailmod) Resume **
Error occurred on line: 137 (orderdetailmod)
java.lang.RuntimeException: Object should first be initialized (Bitmap).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at be.robotronic.roboorder2.orderdetailmod.afterFirstLayout(orderdetailmod.java:108)
at be.robotronic.roboorder2.orderdetailmod.access$000(orderdetailmod.java:17)
at be.robotronic.roboorder2.orderdetailmod$WaitForLayout.run(orderdetailmod.java:80)
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