Hi,
I am using the excellent code by @Johan Schoeman to create a circular image of a head shot. I am getting an error after only about 6 additions. I am actually refreshing the whole screen rather than just adding views so I suspect that this is the cause but I cannot eliminate the problem. The screen is refreshed because the activity gets called after being sent to the background. This is the error
Error occurred on line: 171 (Main)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA$2.run(BA.java:360)
at anywheresoftware.b4a.BA.setActivityPaused(BA.java:432)
at aus.anyfcsapp.joe.main$ResumeMessage.run(main.java:306)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:928)
at android.graphics.Bitmap.createBitmap(Bitmap.java:901)
at android.graphics.Bitmap.createBitmap(Bitmap.java:868)
at aus.anyfcsapp.joe.main.getRoundBitmap(main.java:1238)
... 23 more
I am using the excellent code by @Johan Schoeman to create a circular image of a head shot. I am getting an error after only about 6 additions. I am actually refreshing the whole screen rather than just adding views so I suspect that this is the cause but I cannot eliminate the problem. The screen is refreshed because the activity gets called after being sent to the background. This is the error
Error occurred on line: 171 (Main)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA$2.run(BA.java:360)
at anywheresoftware.b4a.BA.setActivityPaused(BA.java:432)
at aus.anyfcsapp.joe.main$ResumeMessage.run(main.java:306)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:928)
at android.graphics.Bitmap.createBitmap(Bitmap.java:901)
at android.graphics.Bitmap.createBitmap(Bitmap.java:868)
at aus.anyfcsapp.joe.main.getRoundBitmap(main.java:1238)
... 23 more
B4X:
If File.Exists(File.DirAssets,msgTitle & ".png") Then
bmpName = LoadBitmapSample(File.DirAssets, msgTitle & ".png", 200dip, 200dip)
Else
bmpName = LoadBitmapSample(File.DirAssets, "Smiley.png", 200dip, 200dip)
End If
Log(msgTitle & bmpName)
bmpName = nativeMe.RunMethod("getRoundBitmap",Array(bmpName))
[code/]
Can anyone shed any light on how to fix this?
Many Thanks