How to Open a Specific Folder Via Intent in Android?
In this article, we are going to open a specific folder from our App. This feature is useful in many cases. Most of the time when we want to upload any file then the app simply opens the file manager. But we can implement this feature for effective use like whenever any user wants to upload any file then the user will simply choose the folder name like WhatsApp, downloads, etc. Then the user will be directed to that folder only. Let’s see the implementation of this feature.
Reference Articles: Intent in Android
Step by Step Implementation
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.
Step 2: Working with the activity_main.xml file
Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file.
Step 3: Working with the MainActivity.java file
Go to the MainActivity.java file and refer to the following code. Below is the code for the MainActivity.java file. Comments are added inside the code to understand the code in more detail.