Android Question Out of Memory Error

RVP

Active Member
Licensed User
Continuing to work on my project, and I have discovered that if I go back and forth between my main activity and a sub activity a few time, I get a Memory Error. I am going back to the main activity by using the devices Back Button, and doing

B4X:
Sub Activity_Pause (UserClosed As Boolean)
 
If currentrow>-1 Then UpdateCurrentSchedule ' save schedule in case of changes
 
If UserClosed Then
    Activity.Finish
End If
End Sub

The error is

B4X:
** Activity (main) Pause, UserClosed = false **
** Activity (schedule) Create, isFirst = false **
java.lang.OutOfMemoryError
    at android.graphics.Bitmap.nativeCreate(Native Method)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:791)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:768)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:735)
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:76)
    at b4a.example.clswheel._initialize(clswheel.java:1212)
    at b4a.example.schedule._addviews(schedule.java:732)
    at b4a.example.schedule._activity_create(schedule.java:382)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
    at b4a.example.schedule.afterFirstLayout(schedule.java:98)
    at b4a.example.schedule.access$100(schedule.java:16)
    at b4a.example.schedule$WaitForLayout.run(schedule.java:76)
    at android.os.Handler.handleCallback(Handler.java:730)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5414)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    at dalvik.system.NativeStart.main(Native Method)

I have attached the project in case anyone wants to take a look at it. It takes around 4 times going into, and out of the sub activity to cause the error on my device (Samsung Galaxy Tab 3 with 32gb) I assume it may take more or less on another device.

If someone does look at this, and finds the issue, please let me know how you did it so I understand what to do to track these kind of things down.

Thanks
 

Attachments

  • word.zip
    98.6 KB · Views: 123
Top