Check Mobile App
Read now

Android: Check for File explorer presence

Save

Here, today, we will see how we can check if there is any File Explorer present on the device or not. I had to write a code to select a file from device that an be uploaded on server. But as I started finding the solution I got to know that some devices might not even contain a file explorer. so I implemented a file explorer by myself.

But I was not happy as I wanted that user should use his/her own file explorer if they have one. So i Google it for days and finally found a solution here.

Here I applied a check to firstly get if there is any file explorer present in the device or not. And if present then it will be opened and if not then mine one will start.

Here is the small snippet for the same

screenshot_2016-10-07-07-15-16-871After asking for permission ( if your device is above API level 22) you will see a screen like this from where you can select a file you want to upload. To get the path for the file you selected you have to add onActivityResult() method in your activity/ fragment as

And here you go with your File selection from Existing File Explorer.

Source: https://github.com/iPaulPro/aFileChooser/blob/master/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java

. . .

Leave a Comment

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


Be the first to comment.

css.php

Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!

Deniel Kerr

Owner and Founder. Opencart

Talk to Sales
Start a Project

    Message Sent!

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

    Back to Home