Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

Annotation can not find image (pinImage) on android for specific png

$
0
0

Hi guys,

I'm having a mapview with some annotations: (I'm using an alloy project, so the assets are not in the same folders as they are in traditional titanium mobile apps)

// somewhere in my code:
        // lat, lon is defined as parameters
        var marker = MapModule.createAnnotation({
            latitude : lat,
            longitude : lon,
            title : "this is the title"
            subtitle : "this is the subtitle"
            animate : true
        });
 
        if (OS_IOS) {
            marker.image = "/myImage.png"
 
            // not interesting
            marker.rightButton = Titanium.UI.iPhone.SystemButton.DISCLOSURE; 
        } else {
            // I also tried marker.pinImage 
            marker.image = "myImage.png";
            marker.rightButton = 'ic_action_about.png'; // not interesting
        }
And I have these images on my filesystem (since it does not work in android, I will only show the android folder):
+ /assets/
    + /android/
        + /images/
            + /res-long-port-hdpi/
                + myImage.png
                + ic_action_about.png
            + /res-long-port-ldpi/
                + myImage.png
                + ic_action_about.png
            +/.... (all the android res-* folders)/

The thing is:

  • The myImage.png does not have two sizes (it's the same file, same size, just copy paste). I was bit lazy with that in photoshop
  • The ic_action_about.png has both sizes, a smaller and a bigger one

My Problem now:

  • I get a red annotation if I set the marker.image to "myImage.png"
  • But somehow it works great when I change the marker.image to "ic_action_about.png"

why? Is the size too big/small and Titanium somehow recognizes that and show the default red pin, or what?

(I hope I can also help other guys with the same problem here, so it's okay to have such a huge question :D )


Viewing all articles
Browse latest Browse all 7655

Trending Articles



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