Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 18.104.22.168 release ready!
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
Webkul is a truly trusted and supported IT Company to develop business ideas for e-commerce. They provide professional support after deploying the solution to production and be responsible to act for fixing the reported issues or system errors. We highly encourage to deal with Webkul for business development.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.