i am getting File not found exception
when i try to load an image file using KnownFolders.CameraRoll
property. The image is located in the CameraRoll of my windows phone 8. i have also enabled the following capabilities in my application
<Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_MEDIALIB_AUDIO" />
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
<Capability Name="ID_CAP_SENSORS" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
<Capability Name="ID_CAP_MEDIALIB_PHOTO" />
<Capability Name="ID_CAP_ISV_CAMERA" />
and here is my code to fetch the image.
private async void cameraRoll_btn_Click(object sender, RoutedEventArgs
e) {
try {
StorageFile file = await Windows.Storage.KnownFolders.CameraRoll.GetFileAsync("WP_20130607_003.jpg");
var mem = await file.OpenAsync(FileAccessMode.Read);
BitmapImage bitImage = new BitmapImage();
bitImage.SetSource(mem.AsStream());
ImageView.Source = bitImage;
}
catch (Exception ex) {
MessageBox.Show(ex.Message);
}
}
the image WP_20130607_003.jpg
is also present in camera roll and i am deploying the app to the device. it raise exception on the GetFileAsync
line. can any bode give me some hint that what i am doing wrong here?
Thanks
From MSDN:
You can use the PhotoChooserTask to let the user pick a photo. Alternatively, you can use MediaLibrary.Pictures to programmatically access the pictures. For example