Xamarin – Display single image in ImageView from SD Card in Android

In this post we would see how we can display a single image in ImageView from SD Card.


We would have a button control and an ImageView control. On click of the button the image would be loaded on to the ImageView control. The following is the layout for it.


The following is the String.xml file for the resources used in above layout.


Now we would identify the controls we are going to use at run time.


Now on button click event handler we would do the following to display the image in the ImageView control. First of all we would create a File of Java.IO namespace type. Then we would decode it to a Bitmap. Then by using SetImageBitmap method which takes a Bitmap, the image is displayed.


Let’s run the application in action.


On click of the button, the image is displayed from the SD Card.


Hope this post helps, thanks for reading.


Full Source Code: Click Here