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

Memory leak in Android on adding Scrollable View

$
0
0

Hi All,

I am developing a mobile application both for Android and iPhone by using Titanium Alloy using Titanium SDK 3.1.3. I have added a Scrollable View in my app to display a series of remote images. The app works fine in iPhone Simulator but crashes in my Android phone after scrolling through just a few images. I believe because of memory leaks

My code -

// Create the scrollable View containing the views which has the  remote images. 
 
    var scrollableView = Ti.UI.createScrollableView({
        views : viewCollection,
        top : 0,
        right : 0,
        bottom : 0,
        left : 0,
        showPagingControl : true,
        height : "180dp",
        pagingControlHeight : 30,
        pagingControlColor : "black"
    });
    productDetailHomeScreenView.add(scrollableView);
 
    //Implement auto-scrolling of the Scrollable View
 
    function autoScroll() {
        var intCurrentIndex = scrollableView.getCurrentPage();
        var intTotalViews = scrollableView.getViews().length;
        // Ti.API.log('loop: ' + intCurrentIndex);
        if (intCurrentIndex === (intTotalViews - 1)) {
            intCurrentIndex = 0;
        } else {
            intCurrentIndex = intCurrentIndex + 1;
        }
        scrollableView.setCurrentPage(intCurrentIndex);
    }
 
    setInterval(function() {
        autoScroll();
    }, 3000);
Please help me as I am stuck not not knowing how to over come this problem.

Thanks.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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