Hi, With Xamarin Froms on Android following exception is throwing when I set image source with ImageSource.FromFile("filename.png"). Image build action is set to 'AndroidResource'. Do any one have idea what is wrong here?
var img= new Image
{
Source = ImageSource.FromFile("filename.png"),
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
};
UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.Android.ResourceManager.GetId (System.Type type, System.String propertyName) [0x00000] in :0
at Xamarin.Forms.Platform.Android.ResourceManager.IdFromTitle (System.String title, System.Type type) [0x00000] in :0
at Xamarin.Forms.Platform.Android.ResourceManager.GetBitmap (Android.Content.Res.Resources resource, System.String name) [0x00000] in :0
at Xamarin.Forms.Platform.Android.FileImageSourceHandler+d__0.MoveNext () [0x00000] in :0