Android Question TabStrip with CustomListView: too slow and out of memory error

toby

Well-Known Member
Licensed User
Longtime User
There are 12 tabs and every tab has an identical layout showing different data on a customlistView. All data are populated during Activity_Create

The problems I'm having:
1. Too slow: it takes about 15 seconds to load 50 items on the customlistview in release mode. I want to be able to load 200 items in no more than 2 seconds
2. Out of memory error: When the number of items is large (75 would do on my system), the app crashes. I want to be able to load at least 200 items.

I'm thinking about loading single tab at a time on demand when clicked. Before I start doing anything, I would like to hear what are the recommended ways to solve those problems.

Thank you in advance for your advice!

Logger connected to: asus ASUS_X017DA
--------- beginning of crash
FATAL EXCEPTION: main
Process: b4a.example, PID: 27263
java.lang.OutOfMemoryError: Failed to allocate a 166204 byte allocation with 49432 free bytes and 48KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:901)
at android.graphics.Bitmap.createBitmap(Bitmap.java:878)
at android.graphics.Bitmap.createBitmap(Bitmap.java:845)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:81)
at anywheresoftware.b4a.objects.B4XCanvas.Initialize(B4XCanvas.java:37)
at b4a.example.b4xfloattextfield._createbitmap(b4xfloattextfield.java:173)
at b4a.example.b4xfloattextfield._update(b4xfloattextfield.java:627)
at b4a.example.b4xfloattextfield._designercreateview(b4xfloattextfield.java:349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:67)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at b4a.example.grocerylist._createlistitem(grocerylist.java:472)
at b4a.example.grocerylist._activity_create(grocerylist.java:425)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at b4a.example.grocerylist.afterFirstLayout(grocerylist.java:104)
at b4a.example.grocerylist.access$000(grocerylist.java:17)
at b4a.example.grocerylist$WaitForLayout.run(grocerylist.java:82)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6146)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
FATAL EXCEPTION: main
Process: b4a.example, PID: 27297
java.lang.OutOfMemoryError: Failed to allocate a 166204 byte allocation with 50376 free bytes and 49KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:901)
at android.graphics.Bitmap.createBitmap(Bitmap.java:878)
at android.graphics.Bitmap.createBitmap(Bitmap.java:845)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:81)
at anywheresoftware.b4a.objects.B4XCanvas.Initialize(B4XCanvas.java:37)
at b4a.example.b4xfloattextfield._createbitmap(b4xfloattextfield.java:173)
at b4a.example.b4xfloattextfield._update(b4xfloattextfield.java:627)
at b4a.example.b4xfloattextfield._designercreateview(b4xfloattextfield.java:349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:67)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at b4a.example.grocerylist._createlistitem(grocerylist.java:472)
at b4a.example.grocerylist._activity_create(grocerylist.java:425)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at b4a.example.grocerylist.afterFirstLayout(grocerylist.java:104)
at b4a.example.grocerylist.access$000(grocerylist.java:17)
at b4a.example.grocerylist$WaitForLayout.run(grocerylist.java:82)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6146)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
FATAL EXCEPTION: main
Process: b4a.example, PID: 27532
java.lang.OutOfMemoryError: Failed to allocate a 263332 byte allocation with 157160 free bytes and 153KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:901)
at android.graphics.Bitmap.createBitmap(Bitmap.java:878)
at android.graphics.Bitmap.createBitmap(Bitmap.java:845)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:81)
at anywheresoftware.b4a.objects.B4XCanvas.Initialize(B4XCanvas.java:37)
at b4a.example.b4xfloattextfield._createbitmap(b4xfloattextfield.java:173)
at b4a.example.b4xfloattextfield._update(b4xfloattextfield.java:621)
at b4a.example.b4xfloattextfield._designercreateview(b4xfloattextfield.java:349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:67)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at b4a.example.grocerylist._createlistitem(grocerylist.java:472)
at b4a.example.grocerylist._activity_create(grocerylist.java:425)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at b4a.example.grocerylist.afterFirstLayout(grocerylist.java:104)
at b4a.example.grocerylist.access$000(grocerylist.java:17)
at b4a.example.grocerylist$WaitForLayout.run(grocerylist.java:82)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6146)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
FATAL EXCEPTION: main
Process: b4a.example, PID: 27844
java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
FATAL EXCEPTION: main
Process: b4a.example, PID: 29801
java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
FATAL EXCEPTION: Thread-3
Process: b4a.example, PID: 30121
java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
FATAL EXCEPTION: main
Process: b4a.example, PID: 32103
java.lang.OutOfMemoryError: Failed to allocate a 263332 byte allocation with 95992 free bytes and 93KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:901)
at android.graphics.Bitmap.createBitmap(Bitmap.java:878)
at android.graphics.Bitmap.createBitmap(Bitmap.java:845)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:81)
at anywheresoftware.b4a.objects.B4XCanvas.Initialize(B4XCanvas.java:37)
at b4a.example.b4xfloattextfield._createbitmap(b4xfloattextfield.java:173)
at b4a.example.b4xfloattextfield._update(b4xfloattextfield.java:621)
at b4a.example.b4xfloattextfield._designercreateview(b4xfloattextfield.java:349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:67)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at b4a.example.grocerylist._createlistitem(grocerylist.java:472)
at b4a.example.grocerylist._activity_create(grocerylist.java:425)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at b4a.example.grocerylist.afterFirstLayout(grocerylist.java:104)
at b4a.example.grocerylist.access$000(grocerylist.java:17)
at b4a.example.grocerylist$WaitForLayout.run(grocerylist.java:82)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6146)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
FATAL EXCEPTION: main
Process: b4a.example, PID: 741
java.lang.OutOfMemoryError: Failed to allocate a 263332 byte allocation with 101488 free bytes and 99KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:901)
at android.graphics.Bitmap.createBitmap(Bitmap.java:878)
at android.graphics.Bitmap.createBitmap(Bitmap.java:845)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:81)
at anywheresoftware.b4a.objects.B4XCanvas.Initialize(B4XCanvas.java:37)
at b4a.example.b4xfloattextfield._createbitmap(b4xfloattextfield.java:173)
at b4a.example.b4xfloattextfield._update(b4xfloattextfield.java:621)
at b4a.example.b4xfloattextfield._designercreateview(b4xfloattextfield.java:349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:67)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at b4a.example.grocerylist._createlistitem(grocerylist.java:472)
at b4a.example.grocerylist._activity_create(grocerylist.java:425)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at b4a.example.grocerylist.afterFirstLayout(grocerylist.java:104)
at b4a.example.grocerylist.access$000(grocerylist.java:17)
at b4a.example.grocerylist$WaitForLayout.run(grocerylist.java:82)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6146)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
FATAL EXCEPTION: main
Process: b4a.example, PID: 6342
java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
--------- beginning of main
uid=10199(b4a.example) expire 1666 lines
uid=10199(b4a.example) expire 2 lines
uid=10199(b4a.example) expire 4 lines
uid=10199(b4a.example) expire 6 lines
uid=10199(b4a.example) expire 133 lines


ignoring event: fedtitemname_textchanged
ignoring event: tf_textchanged
ignoring event: fedtitemname_textchanged
ignoring event: tf_textchanged
ignoring event: fedtitemname_textchanged
time spent to populate 12x50 data: 15304 milliseconds
** Activity (main) Resume **
Skipped 919 frames! The application may be doing too much work on its main thread.
Skipped 122 frames! The application may be doing too much work on its main thread.
Do partial code cache collection, code=125KB, data=121KB
After code cache collection, code=125KB, data=121KB
Increasing code cache capacity to 512KB
 

Attachments

  • TabStripCustomListView.zip
    12.4 KB · Views: 270
Top