Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Problem with Table Rows,if I change bgcolor to all TbRows gives me JNI local ref table (has 512 entries)

$
0
0

Hello,

I have an application and in the home I have one TableView with 14 TableViewRows, when I click in one of this tblViewRow change the color of background color and store it in an array. It works well, but one of the tblViewRow is used to select all, when i select all app crashed and gives me error of JNI local ref table (has 512 entries). The code of Table view:

var rows = [];
        var categorias = [
            {titre: L('ALL'), id: 0},
            {titre: L('ELEMENT_1'), id: 1},
            {titre: L('ELEMENT_2'), id: 2},
            {titre: L('ELEMENT_3'), id: 3},
            {titre: L('ELEMENT_4'), id: 4},
            {titre: L('ELEMENT_5'), id: 5},
            {titre: L('ELEMENT_6'), id: 6},
            {titre: L('ELEMENT_7'), id: 7},
            {titre: L('ELEMENT_8'), id: 8},
            {titre: L('ELEMENT_9'), id: 9},
            {titre: L('ELEMENT_10'), id: 10},
            {titre: L('ELEMENT_11'), id:11},
            {titre: L('ELEMENT_12'), id: 12},
        ];
        for(var i in categorias){
            var row = Ti.UI.createTableViewRow({
                backgroundSelectedColor : '#fff',
                selectionStyle : (Ti.Platform.osname=='iphone') ? Ti.UI.iPhone.TableViewCellSelectionStyle.NONE : null,
                height : h(30),
                id: categorias[i].id,
                sel: false,
            });
            row.add(Ti.UI.createLabel({
                font: {fontSize: h(14), fontFamily: blk.app.customFont},
                color: '#2d2d2f',
                textAlign: 'left',
                text: categorias[i].titre,
                left: 0,
                width: Ti.UI.SIZE,
                height : Ti.UI.SIZE,
                backgroundColor : 'transparent',
                shadowColor: (categorias[i].id==0) ? '#000' : null,
            }));
            rows.push(row);
        }
 
        var categoriasList = Ti.UI.createTableView({
            width : w(130),
            height: h(220),
            top : h(27),
            left : w(5),
            data : rows,
            separatorColor : '#fff',
            color : "#2d2d2f",
            bubbleParent: false
        });
 
        categoriasList.addEventListener('click', function(e){
            optionSel(e.row, 'categoria');
        });
And the code of the on click event selection:
function optionSel(e, type){
            if (e.id==0) {
                // select/deselect all
                optionSelAll(e.sel, type);
                return;
            }
 
            if(type == 'color') {
                if (e.id!==0) {
                    coloresList.data[0].rows[0].sel = false;
                    coloresList.data[0].rows[0].children[0].backgroundColor = 'transparent';
                }
                if (!e.sel) {
                    e.sel = true;
                    e.children[0].backgroundColor = '#FFFF99';
                    idsColor[e.id] = true;
                } else {
                    e.sel = false;
                    e.children[0].backgroundColor = 'transparent';
                    idsColor[e.id] = false;
                }
                //traceObject(idsColor);
            } else if (type == 'categoria') {
                if (e.id!==0) {
                    categoriasList.data[0].rows[0].sel = false;
                    categoriasList.data[0].rows[0].children[0].backgroundColor = 'transparent';
                }
                if (!e.sel) {
                    e.sel = true;
                    e.children[0].backgroundColor = '#FFFF99';
                    idsCategoria[e.id] = true;
                } else {
                    e.sel = false;
                    e.children[0].backgroundColor = 'transparent';
                    idsCategoria[e.id] = false;
                }
                //traceObject(idsCategoria);
            }
            return;
        }
 
        function optionSelAll(active,type){
            switch(type){
                case 'color':
                    // manage select/deselect colores
                    for(var i=0; i<colores.length; i++){
                        coloresList.data[0].rows[i].sel = (!active) ? true : false;
                        // If i coment this line, works well the problem of JNI occurs if this line uncomment
                        coloresList.data[0].rows[i].children[0].backgroundColor = (!active) ? '#FFFF99' : 'transparent';
                        idsColor[coloresList.data[0].rows[i].id] = (!active) ? true : false;
                    }
                    //traceObject(idsColor);
                    break;
 
                case 'categoria':
                    // manage select/deselect categorias
                    for(var i=0; i<categorias.length; i++){
                        categoriasList.data[0].rows[i].sel = (!active) ? true : false;
                        // If i coment this line, works well the problem of JNI occurs if this line uncomment
                        categoriasList.data[0].rows[i].children[0].backgroundColor = (!active) ? '#FFFF99' : 'transparent';
                        idsCategoria[categoriasList.data[0].rows[i].id] = (!active) ? true : false;
                    }
                    //traceObject(idsCategoria);
                    break;
            }
            return;
        };
Logs of the crash:
[ERROR][dalvikvm(  472)] Failed adding to JNI local ref table (has 512 entries)
[INFO][dalvikvm(  472)] "KrollRuntimeThread" prio=5 tid=10 RUNNABLE
[INFO][dalvikvm(  472)]   | group="main" sCount=0 dsCount=0 obj=0x4065ed70 self=0x2d7a08
[INFO][dalvikvm(  472)]   | sysTid=484 nice=0 sched=0/0 cgrp=default handle=2984136
[INFO][dalvikvm(  472)]   | schedstat=( 2984899002 1317521145 514 )
[INFO][dalvikvm(  472)]   at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[INFO][dalvikvm(  472)]   at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:64)
[INFO][dalvikvm(  472)]   at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:835)
[INFO][dalvikvm(  472)]   at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1059)
[INFO][dalvikvm(  472)]   at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:316)
[INFO][dalvikvm(  472)]   at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:936)
[INFO][dalvikvm(  472)]   at android.os.Handler.dispatchMessage(Handler.java:95)
[INFO][dalvikvm(  472)]   at android.os.Looper.loop(Looper.java:130)
[INFO][dalvikvm(  472)]   at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[INFO][dalvikvm(  472)] 
[ERROR][dalvikvm(  472)] VM aborting
[INFO][DEBUG   (   31)] *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
[INFO][DEBUG   (   31)] Build fingerprint: 'generic/google_sdk/generic:2.3.4/GINGERBREAD/123630:eng/test-keys'
[INFO][DEBUG   (   31)] pid: 472, tid: 484  >>> com. xxxxxxxx. xxxxxxxx <<<
[INFO][DEBUG   (   31)] signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
[INFO][DEBUG   (   31)]  r0 fffffec4  r1 deadd00d  r2 00000026  r3 00000000
[INFO][DEBUG   (   31)]  r4 800a45c0  r5 40665170  r6 002d7b40  r7 002d7a08
[INFO][DEBUG   (   31)]  r8 000002b4  r9 40577b80  10 002fd27c  fp 443088b4
[INFO][DEBUG   (   31)]  ip 800a4720  sp 443087d0  lr afd19375  pc 80045a4a  cpsr 20000030
[INFO][DEBUG   (   31)]          #00  pc 00045a4a  /system/lib/libdvm.so
[INFO][DEBUG   (   31)]          #01  pc 00049e06  /system/lib/libdvm.so
[INFO][DEBUG   (   31)]          #02  pc 00049eb4  /system/lib/libdvm.so
[INFO][DEBUG   (   31)]          #03  pc 00039022  /system/lib/libdvm.so
[INFO][DEBUG   (   31)]          #04  pc 0007d9de  /mnt/asec/com. xxxxxxxx. xxxxxxxx-2/lib/libkroll-v8.so
[INFO][DEBUG   (   31)]          #05  pc 0007dcb4  /mnt/asec/com. xxxxxxxx. xxxxxxxx-2/lib/libkroll-v8.so
[INFO][DEBUG   (   31)]          #06  pc 0007dcf4  /mnt/asec/com. xxxxxxxx. xxxxxxxx-2/lib/libkroll-v8.so
[INFO][DEBUG   (   31)]          #07  pc 0007da4c  /mnt/asec/com. xxxxxxxx. xxxxxxxx-2/lib/libkroll-v8.so
[INFO][DEBUG   (   31)]          #08  pc 0011cf18  /mnt/asec/com. xxxxxxxx. xxxxxxxx-2/lib/libkroll-v8.so
[INFO][DEBUG   (   31)] 
[INFO][DEBUG   (   31)] code around pc:
[INFO][DEBUG   (   31)] 80045a28 447a4479 ed0cf7d1 20004c09 ee34f7d1 
[INFO][DEBUG   (   31)] 80045a38 447c4808 6bdb5823 d0002b00 49064798 
[INFO][DEBUG   (   31)] 80045a48 700a2226 eea0f7d1 000436b7 00045275 
[INFO][DEBUG   (   31)] 80045a58 0005eb82 fffffec4 deadd00d b510b40e 
[INFO][DEBUG   (   31)] 80045a68 4c0a4b09 447bb083 aa05591b 6b5bca02 
[INFO][DEBUG   (   31)] 
[INFO][DEBUG   (   31)] code around lr:
[INFO][DEBUG   (   31)] afd19354 b0834a0d 589c447b 26009001 686768a5 
[INFO][DEBUG   (   31)] afd19364 220ce008 2b005eab 1c28d003 47889901 
[INFO][DEBUG   (   31)] afd19374 35544306 d5f43f01 2c006824 b003d1ee 
[INFO][DEBUG   (   31)] afd19384 bdf01c30 000281a8 ffffff88 1c0fb5f0 
[INFO][DEBUG   (   31)] afd19394 43551c3d a904b087 1c16ac01 604d9004 
[INFO][DEBUG   (   31)] 
[INFO][DEBUG   (   31)] stack:
[INFO][DEBUG   (   31)]     44308790  00000015  
[INFO][DEBUG   (   31)]     44308794  afd18407  /system/lib/libc.so
[INFO][DEBUG   (   31)]     44308798  afd4270c  /system/lib/libc.so
[INFO][DEBUG   (   31)]     4430879c  afd426b8  /system/lib/libc.so
[INFO][DEBUG   (   31)]     443087a0  00000000  
[INFO][DEBUG   (   31)]     443087a4  afd19375  /system/lib/libc.so
[INFO][DEBUG   (   31)]     443087a8  002d7a08  [heap]
[INFO][DEBUG   (   31)]     443087ac  afd183d9  /system/lib/libc.so
[INFO][DEBUG   (   31)]     443087b0  002d7a08  [heap]
[INFO][DEBUG   (   31)]     443087b4  0005eb82  [heap]
[INFO][DEBUG   (   31)]     443087b8  40665170  /dev/ashmem/dalvik-heap (deleted)
[INFO][DEBUG   (   31)]     443087bc  002d7b40  [heap]
[INFO][DEBUG   (   31)]     443087c0  002d7a08  [heap]
[INFO][DEBUG   (   31)]     443087c4  afd18437  /system/lib/libc.so
[INFO][DEBUG   (   31)]     443087c8  df002777  
[INFO][DEBUG   (   31)]     443087cc  e3a070ad  
[INFO][DEBUG   (   31)] #00 443087d0  002d7a08  [heap]
[INFO][DEBUG   (   31)]     443087d4  80049e0b  /system/lib/libdvm.so
[INFO][DEBUG   (   31)] #01 443087d8  002d8b58  [heap]
[INFO][DEBUG   (   31)]     443087dc  41adee94  /dev/ashmem/dalvik-LinearAlloc (deleted)
[INFO][DEBUG   (   31)]     443087e0  406651f0  /dev/ashmem/dalvik-heap (deleted)
[INFO][DEBUG   (   31)]     443087e4  80049eb9  /system/lib/libdvm.so
[INFO][ActivityManager(   62)] Process com. xxxxxxxx. xxxxxxxx (pid 472) has died.
Application type: mobile Titanium SDK: 3.1.1 Platform & version: Android 2.3.3 AND Android 4.0 Device: iOS simulator, Emulator Host Operating System: Ubuntu 12.04 Titanium Studio: Titanium Studio, build: 3.1.1.201306112235

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>