I using mapsui to show an IGN map on my application and I want to make a screenshot of the map when I click on a specific button. So I use dependency injection and It works perfectly on UWP. But with Android, I can't screen the map and I have a white screen. There is my code for Android :
public Task<byte[]> TakeShot()
{
var _activity = CrossCurrentActivity.Current;
if (_activity == null)
{
throw new Exception("You have to set ScreenshotManager.Activity in your Android project");
}
var view = _activity.Activity.Window.DecorView;
view.DrawingCacheEnabled = true;
Bitmap bitmap = view.GetDrawingCache(true);
view.BuildDrawingCache();
byte[] bitmapData;
using (var stream = new MemoryStream())
{
bitmap.Compress(Bitmap.CompressFormat.Png, 0, stream);
bitmapData = stream.ToArray();
}
return Task.FromResult(bitmapData);
}
Only the map is blank, because I have my button on the image. Thank's for your help