Xamarin – Write file to SD Card in Android

In this post we would how we write a file to SD Card in Android.


First of all, you need to set the following permission in Android Manifest.


Here is how it would look on XML.


So the plan is, we would write a file on application startup and read the file on button click.

So the following layout xml has a button and a TextView in it.


Here in the following code, we are checking if the file doesn’t exist; we would create the file.


Now the reading part is very simple, we already have seen in my previous post.


Let’s run the application, and click on the button; you would read the file which is just created.


Hope this post helps, thanks for reading.


Full Source Code: Click Here