1
I am using the following code to save the image in Isolatestorage:
String tempJPEG = "/Shared/Media/card.jpg";
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
if (myIsolatedStorage.FileExists(tempJPEG))
{
myIsolatedStorage.DeleteFile(tempJPEG);
}
IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(tempJPEG);
Extensions.SaveJpeg(bmp, fileStream, bmp.PixelWidth, bmp.PixelHeight, 0, 85);
fileStream.Close();
}
And this code to try to save the image in the gallery:
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("/Shared/Media/card.jpg", FileMode.Open, FileAccess.ReadWrite))
{
MediaLibrary mediaLibrary = new MediaLibrary();
mediaLibrary.SavePicture("SavedCard.jpg", fileStream);
fileStream.Close();
}
}
But when I try to run the app, it closes and in Visual gives this error:
I’ve been trying to solve this problem for days. I found an example, but it uses image of the project itself, so it is easy, in my case the image is of the project, but it is edited by the user and saved in Isolatestorage..
I don’t know this but the error indicates that the user does not have access to the location. It doesn’t seem to be a problem in the code other than the fact that it doesn’t handle the exception.
– Maniero
I do not know exactly why the error, in the code that I saw the image was original app, and there is a folder of SD Card or Phone where the app is stored, and even saving this image there gives the same error, so I do not believe it is the permission problem.. Very strange this rs
– Leonardo