Rendering ImageViews in ScrollView or in TableView? Which is faster?

You must Login before you can answer or comment on any questions.

Hi, I am developing an app that has a performance issue. I am currently using scrollview and and the top and left property to place images in grid.. Can i use tableview as an alternative to increase performance. Someone replied here in forums that tableview rendering in V8 is optimized. I am using V8, sdk 2.0.1, android sdk and testing on android device with 512mb ram and 1ghz speed.

2 Answers

How big are your images? The ones I'm serving are 120x90 or 160x120.

— answered 11 months ago by Jason Priebe
answer permalink
2 Comments
  • mine are 306x306 which i m adjusting in a 260x260 imageview.... provided my imageview is enclosed in a white view... also there are 2 buttons with background, 2 labels and one mini 60x60 image with each 306x306 image.

    — commented 11 months ago by Aadil Farooq

  • Seems like 306x306 is not too big. You might want to try to create a minimal case that exhibits the problem. That might help you get to the bottom of it. And if it doesn't, you can post the code here (preferably a single app.js) so somebody can take a look at it.

    — commented 11 months ago by Jason Priebe

How many images are you putting in the grid? I put about 50 into a grid with 4 columns in a scrollview, and performance is very good across all devices we've tested (android and iOS).

— answered 11 months ago by Jason Priebe
answer permalink
1 Comment
  • well i am using 2 columns and when the grid loads around 13 images it starts to missing images in between and displays the following error in console.

    [ERROR][ActivityManager(   72)] ANR in com.outlclick.myapp(com.outlclick.myapp/.MyAppActivity)
    [ERROR][ActivityManager(   72)] Reason: keyDispatchingTimedOut
    [ERROR][ActivityManager(   72)] Load: 2.64 / 0.98 / 0.64
    [ERROR][ActivityManager(   72)] CPU usage from 21845ms to 1825ms ago:
    [ERROR][ActivityManager(   72)]   60% 836/com.outlclick.myapp: 55% user + 4.6% kernel / faults: 3926 minor
    [ERROR][ActivityManager(   72)]   35% 72/system_server: 34% user + 1.4% kernel / faults: 2 minor
    [ERROR][ActivityManager(   72)]   0.3% 26/mmcqd: 0% user + 0.3% kernel
    [ERROR][ActivityManager(   72)]   0% 4/events/0: 0% user + 0% kernel
    [ERROR][ActivityManager(   72)]   0% 193/com.android.systemui: 0% user + 0% kernel / faults: 1 minor
    [ERROR][ActivityManager(   72)] 98% TOTAL: 92% user + 5.9% kernel + 0.3% irq + 0.4% softirq
    [ERROR][ActivityManager(   72)] CPU usage from 685ms to 1236ms later:
    [ERROR][ActivityManager(   72)]   73% 72/system_server: 67% user + 5.3% kernel / faults: 113 minor
    [ERROR][ActivityManager(   72)]     46% 82/SurfaceFlinger: 44% user + 1.7% kernel
    [ERROR][ActivityManager(   72)]     10% 158/InputDispatcher: 7.1% user + 3.5% kernel
    [ERROR][ActivityManager(   72)]     8.9% 156/WindowManager: 8.9% user + 0% kernel
    [ERROR][ActivityManager(   72)]     3.5% 496/Binder Thread #: 3.5% user + 0% kernel
    [ERROR][ActivityManager(   72)]   23% 836/com.outlclick.myapp: 21% user + 2.5% kernel / faults: 158 minor
    [ERROR][ActivityManager(   72)]     11% 836/click.myapp: 10% user + 1.2% kernel
    [ERROR][ActivityManager(   72)]     7.5% 847/KrollRuntimeThr: 7.5% user + 0% kernel
    [ERROR][ActivityManager(   72)]     1.2% 842/Compiler: 1.2% user + 0% kernel
    [ERROR][ActivityManager(   72)]     1.2% 843/Binder Thread #: 1.2% user + 0% kernel
    [ERROR][ActivityManager(   72)]     1.2% 877/TiHttpClient-24: 1.2% user + 0% kernel
    [ERROR][ActivityManager(   72)]     1.2% 889/TiHttpClient-36: 1.2% user + 0% kernel
    [ERROR][ActivityManager(   72)] 100% TOTAL: 92% user + 7.4% kernel
    [INFO][InputDispatcher(   72)] Dropping event because the pointer is not down.
    [INFO][dalvikvm-heap(  836)] Clamp target GC heap from 24.163MB to 24.000MB
    [INFO][dalvikvm-heap(  836)] Clamp target GC heap from 24.305MB to 24.000MB
    [INFO][dalvikvm-heap(  836)] Clamp target GC heap from 24.588MB to 24.000MB
    [INFO][dalvikvm-heap(  836)] Clamp target GC heap from 24.848MB to 24.000MB
    [INFO][dalvikvm-heap(  836)] Clamp target GC heap from 25.045MB to 24.000MB
    [INFO][dalvikvm-heap(  836)] Clamp target GC heap from 25.009MB to 24.000MB
    [ERROR][dalvikvm-heap(  836)] 135200-byte external allocation too large for this process.
    [INFO][dalvikvm-heap(  836)] Clamp target GC heap from 24.994MB to 24.000MB
    [ERROR][GraphicsJNI(  836)] VM won't let us allocate 135200 bytes
    [ERROR][TiDrawableReference(  836)] (main) [33323,83096] Unable to load bitmap. Not enough memory: bitmap size exceeds VM budget
    [ERROR][TiDrawableReference(  836)] java.lang.OutOfMemoryError: bitmap size exceeds VM budget
    [ERROR][TiDrawableReference(  836)]     at android.graphics.Bitmap.nativeCreate(Native Method)
    [ERROR][TiDrawableReference(  836)]     at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
    [ERROR][TiDrawableReference(  836)]     at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
    [ERROR][TiDrawableReference(  836)]     at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
    [ERROR][TiDrawableReference(  836)]     at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:590)
    [ERROR][TiDrawableReference(  836)]     at ti.modules.titanium.ui.widget.TiUIImageView.setImage(TiUIImageView.java:748)
    [ERROR][TiDrawableReference(  836)]     at ti.modules.titanium.ui.widget.TiUIImageView.processProperties(TiUIImageView.java:861)
    [ERROR][TiDrawableReference(  836)]     at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:737)
    [ERROR][TiDrawableReference(  836)]     at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:530)
    [ERROR][TiDrawableReference(  836)]     at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:522)
    [ERROR][TiDrawableReference(  836)]     at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:500)
    [ERROR][TiDrawableReference(  836)]     at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:616)
    [ERROR][TiDrawableReference(  836)]     at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:307)
    [ERROR][TiDrawableReference(  836)]     at ti.modules.titanium.ui.ScrollViewProxy.handleMessage(ScrollViewProxy.java:98)
    [ERROR][TiDrawableReference(  836)]     at android.os.Handler.dispatchMessage(Handler.java:95)
    [ERROR][TiDrawableReference(  836)]     at android.os.Looper.loop(Looper.java:123)
    [ERROR][TiDrawableReference(  836)]     at android.app.ActivityThread.main(ActivityThread.java:3683)
    [ERROR][TiDrawableReference(  836)]     at java.lang.reflect.Method.invokeNative(Native Method)
    [ERROR][TiDrawableReference(  836)]     at java.lang.reflect.Method.invoke(Method.java:507)
    [ERROR][TiDrawableReference(  836)]     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    [ERROR][TiDrawableReference(  836)]     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    [ERROR][TiDrawableReference(  836)]     at dalvik.system.NativeStart.main(Native Method)

    Although app doest crashes up and it runs quite well.

    — commented 11 months ago by Aadil Farooq

Your Answer

Think you can help? Login to answer this question!