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

Random images being set to ImageView

$
0
0

I'm trying to create a feature where the app listens to a singletap event on an image and another predefined ImageView sets its image to the "section" (cropped image) that the user selected. I pass this cropped image as a Titanium blob into a function that does this for me. My code is fairly lengthy but I think I have narrowed it down to this:

The imageview that is listening to the singletap is in an Android module. So the image is being passed from the module to Titanium and the xml file is similar to this:

<Alloy>
    <Window class="container">
        <View id="imageContainer" backgroundColor="white" platform="android">
            <ImageView id="imageView"></ImageView>
        </View>
    </Window>
</Alloy>
In the js file, I use an event listener to identify a singletap event and I crop the image for display. I pass it as a Titanium blob to a function that sets the image. The only relevant code I can think of for the image is just $.imageView.setImage(imageBlob);.

The problem is that the images become random after a few selections. So, for example, if I selected Section A, then Section B, then Section C, then Section D and then back to Section B, this last selection doesn't show the image for Section B but one of the other sections (randomly too)! I've tested to see if the image blob was modified somehow but it seems to be fine. I can only think that there is something wrong with setting the image. Could there be a problem with using a blob as an image? I don't understand why the image I specified is not being set and displayed as expected.

This is a problem in Android only. I'm working with Titanium 3.2.0 on a Mac OS X 10.9.1 and I'm using a physical device for debugging.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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