Storage Access Framework

Storage Access Framework (SAF) was introduced with the release of Android 4.4 (API level 19). However the new selector UI provides the user an easy way to access files stored on their device and in the cloud , it doesn’t necessarily give developers the same ease of use.

I am writing this tutorial by digging up the API Guide. I will be writing a step by step coding guide for you so that you can try it out by your own with all your comfort.

The code is basic , so if you’ve worked with Android’s flavor of Java project before you shouldn’t have any problem understanding what’s going on.

Step1: Create a new android project in your android IDE. 

Step2: Add the following permissions to your manifest file:

 

 

 

Step3: Write the following into your layout file:

 

 

 

Step4:  Write the following into main java file:

 

 

 

Step5: Run for the output like below:

  saf2

saf3

Leave a Comment: