Pregunta

I have an error in my Titanium app with later versions of Android. I'm creating multiple images using the same filename but with different sizes. If I remove the sizes it works fine, but if I leave the size adjustments I get a crash saying that the canvas is trying to use a recycled bitmap. Anybody else come across this or have an idea of how to fix it?

I'm doing this in a loop. If I have the width and height there I get the recycle error. If I remove the height and width it's fine but the images are too big.

I've also tried reading the file into a blob and creating the image that way to make sure the file is released, same problem.

// Create an image
var myImage = Ti.UI.createImageView({
    image: "filename",
    width: imageWidth + 'dp',
    height: imageHeight + 'dp',
    bottom: imageBottom + 'dp',
    zIndex: lastIndex + 5
});

// Add image to main view
mainView.add(myImage);
¿Fue útil?

Solución

Turns out, if I set the image file as the backgroundImage instead of the image, it stops crashing.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top