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

Application crash's while loading images in tableviewrow

$
0
0

Hi all i have a following code.

XML

<TableView id="detailstable"></TableView>
js
Alloy.Globals.Underscore.each(restaruntdetails, function(element, Index) {
 
        var arg = {
                "id" : Index,
                "restimage" : restaruntdetails[Index].imageUrl[0],
                    "restname" : restaruntdetails[Index].name,
                "restid" : restaruntdetails[Index].restaurantsId,
                "restaddress" : restaruntdetails[Index].city
            };
 
        var row = Alloy.createController('row', arg).getView();
            detailsarrayvalue.push(row);
                        });
        $.detailstable.visible = true;
            $.detailstable.setData(detailsarrayvalue);
row.js
var ARG = arguments[0] || {};
$.restarentimage.image = "";
Alloy.Globals.ImageLoader.LoadRemoteImage($.restarentimage, ARG.restimage);
$.restarentname.text = ARG.restname;
 
$.address.text = ARG.restaddress;
row.xml
<Alloy>
    <TableViewRow id="rowview">
        <View id="detailsview">
            <ImageView id="restarentimage"></ImageView>
            <Label id="restarentname"></Label>
            <Label id="address"></Label>
            <Button id="viewdetails">View</Button>
        </View>
    </TableViewRow>
</Alloy>
Image loader
function LoadRemoteImage(obj, url) {
    var xhr = Ti.Network.createHTTPClient();
    xhr.onload = function() {
    //  Ti.API.info('image data=' + this.responseData);
        obj.image = this.responseData;
    };
    // open the client
    xhr.open('GET', url);
    // send the data
    xhr.send();
}
 
exports.LoadRemoteImage = LoadRemoteImage;
when i scroll the table i'm getting out of memory exception and my application crash's pls help me to handel images in tabelview in a better way

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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