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

mapview.toImage() not working on Android

$
0
0

Hi,

I'm facing this problem since fews days, I can't get an image of my mapview on Android. This is working perfectly on IOS.

I have created a mapview, I added it to one of my Alloy view.

var mapview = Map.createView({ mapType : Map.NORMAL_TYPE, animate : true, region : region, regionFit : true, userLocation : false, visible : true, top : 0, width : '100%' });

//I Add annotations and a path ... I skipped this part

$.mapContainer.add(mapview)

//My map is showing perfectly on the screen

function onClickShare() {

var Blob = $.mapContainer.toImage();

// I tried also : $.mapContainer.toImage().media, mapview.toImage(), and mapview().toImage.media 
// .media is not valid image, mapview.toImage() gives me same result

var file = Titanium.Filesystem.getFile(Titanium.Filesystem.tempDirectory, 'share_map.png');
file.write(Blob);

//Calling my functions to share on social networks
shareHelper.share();

}

My image is existing, the only thing is that I get an empty map : http://postimg.org/image/i1u0emfyr/

I also tried to do a screenshot of the whole screen with Titanium.Media.takeScreenshot, I get all the elements of my view but map still empty.

If anyone have an idea what I'm doing wrong ? Thanks very much for your help

Tested with : Titanium SDK 5.0.0GA, Ti.map 2.3.3 On Device (Galaxy note 2), On Genymotion simulator (Google Nexus 5, API 22)


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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