-1

I want to save some picture by tapping on the button to the gallery of the device and I tried to save a file with the code below and I found this code on Xamarin website but they are not defined and I could not find the reference of them.

NSData imgData = photo.AsJPEG();
NSError err = null;
if (imgData.Save(jpgFilename, false, out err))
{
    Console.WriteLine("saved as " + jpgFilename);
}
else
{
    Console.WriteLine("NOT saved as " + jpgFilename + " because" + err.LocalizedDescription);
}
elena1989
  • 1
  • 2

2 Answers2

0

You can save an image to gallery like this:

await Device.Media.SaveToAlbum(image);
ctyar
  • 931
  • 2
  • 10
  • 22
0

To save some file into the gallery by Zebble extension for Xamarin you can use this code

FileInfo myImageFile = ...;
await Device.Media.SaveToAlbum(myImageFile);

And remember this is the extension for Xamarin and you should read the documentation of it to get more information about it and you can not use Xamarin codes in this extension. For more information you can see link below: http://zebble.net/docs/reading-and-writing-into-gallery-albums

Disclaimer: I am a Zebble project contributor and engage in technical support.

J.ws
  • 16