How File Chooser works in Android Studio

Updated 27 July 2021


In this tutorial we will discuss How File Chooser works in Android Studio . File Chooser allow users to select a file which is in phone memory.


In activity_main layout we take an ImageView and a textview. When we upload image then in textview we show file name and file path.


we need to provide permission for read external storage so we added permission.


In MainActivity we ask for permission and if there is already permission we can pick file. We are creeating new Intent ACTION_GET_CONTENT. we also added CATEGORY_OPENABLE for open category and then call startActivityForResult.

Here we will get data in onActivityResult function and here we check if request code is equals to MY_RESULT_CODE_FILECHOOSER then we will get file data. We can fetch data from FileUtils class.If we need file name and file path then we will call FileUtils function getFilleName and getPath().


We can get FileName and FilePath from this class.We are using IOUtils so we need to add dependency for this.

dependency for IOUtils

Please check attached image here we pick a file and you can see we are showing file name and file path in textview.


So Here we discussed  How File Chooser works in Android Studio. Thanks for reading this blog and You can get other blogs from here

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home