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

Slow add view

$
0
0

Hi,

SDK titanium 3.5.1GA => Android => Device Galaxy tab 7" => Android 4.1.1

I have the following code :

view.addEventListener('singletap', function(e) {
                    Ti.API.info('TEST 1 : ' + vmp.time());
                    vmp.ui.current_view = vmp.getScrollableView(c, cid,true);
                    Ti.API.info('TEST 2 : ' + vmp.time());
                    var postLayoutFn = function(e) {                    
                        Ti.API.info('TEST 5 : ' + vmp.time());
                        vmp.ui.loggedIn_view.children[vmp.ui.loggedIn_view.children.length - 2].hide();
                        setTimeout(function() {
                            vmp.ui.blockViewIsLoading = false;
                        }, 300);
                        if (e && e.source)
                            e.source.removeEventListener('postlayout', postLayoutFn);
                    };
                    vmp.ui.current_view.addEventListener('postlayout', postLayoutFn);
                    Ti.API.info('TEST 3 : ' + vmp.time());
                    vmp.ui.loggedIn_view.add(vmp.ui.current_view);
                    Ti.API.info('TEST 4 : ' + vmp.time());
 
        });
The console :
[INFO] :   TEST 1 : Time : 28/5/2015 - 11:21:5:778. Diff :
[INFO] :   TEST 2 : Time : 28/5/2015 - 11:21:5:942. Diff : 0 days, 0 hours, 0 minutes, 0 seconds, 164 miliseconds
[INFO] :   TEST 3 : Time : 28/5/2015 - 11:21:5:945. Diff : 0 days, 0 hours, 0 minutes, 0 seconds, 3 miliseconds
[INFO] :   TEST 4 : Time : 28/5/2015 - 11:21:7:453. Diff : 0 days, 0 hours, 0 minutes, 1 seconds, 508 miliseconds
[INFO] :   TEST 5 : Time : 28/5/2015 - 11:21:7:464. Diff : 0 days, 0 hours, 0 minutes, 0 seconds, 11 miliseconds
The time for add the view (1.5s) was terrible slow for my navigation that was completely unusable, so my question there is a best way to add a view dynamically when i click in an element? (I precise that was slow only in Android test the same code in iOS and the add was really speed, an other precision i test with simple scrollableView where i get view with some view inside with just a background color, normally that was imageView with image and that was more slow...). If add was the reason maybe a replace view or other trick... (than the hide+add can do faster).

If you need some precision ask me.

Thanks in advance for your help.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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