├── .classpath ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── README.md ├── project.properties ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-ldpi │ ├── dir_up.png │ ├── file_icon.png │ ├── folder_icon.png │ ├── folder_icon_light.png │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── layout │ ├── main.xml │ └── ua_com_vassiliev_filebrowser_layout.xml └── values │ └── strings.xml └── src └── ua └── com └── vassiliev └── androidfilebrowser ├── AndroidFileBrowserExampleActivity.java └── FileBrowserActivity.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | AndroidFileBrowser 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 3 | org.eclipse.jdt.core.compiler.compliance=1.5 4 | org.eclipse.jdt.core.compiler.source=1.5 5 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AndroidFileBrowser 2 | ================== 3 | 4 | Provides an Activity, which can be used to select files/folders from the application. 5 | This project is based on the Manish Burman's Android-File-Explore project (https://github.com/mburman/Android-File-Explore), but is heavily rewritten. 6 | 7 | And example Eclipse project is included. 8 | 9 | To use the component in your project, you would need to copy the following (to the same folders of your project): 10 | 1. ua\com\vassiliev\androidfilebrowser\FileBrowserActivity.java from src folder 11 | 2. a. folder_icon_light.png 12 | b. dir_up.png 13 | c. file_icon.png 14 | d. folder_icon.png all from res\drawable-ldpi 15 | 3. res\layout\ua_com_vassiliev_filebrowser_layout.xml 16 | 17 | Change line 37 (import of ua.com.vassiliev.androidfilebrowser.R) to the R file of your project, so resources you copied would be available for the FileBrowser. 18 | 19 | To call the activity you do it as alwasy (see AndroidFileBrowserExampleActivity.java): 20 | ``` 21 | Intent fileExploreIntent = new Intent( 22 | ua.com.vassiliev.androidfilebrowser.FileBrowserActivity.INTENT_ACTION_SELECT_DIR, 23 | null, 24 | activityForButton, 25 | ua.com.vassiliev.androidfilebrowser.FileBrowserActivity.class 26 | ); 27 | // fileExploreIntent.putExtra( 28 | // ua.com.vassiliev.androidfilebrowser.FileBrowserActivity.startDirectoryParameter, 29 | // "/sdcard" 30 | // );//Here you can add optional start directory parameter, and file browser will start from that directory. 31 | startActivityForResult( 32 | fileExploreIntent, 33 | REQUEST_CODE_PICK_FILE_TO_SAVE_INTERNAL 34 | ); 35 | ``` 36 | 37 | To get result overrider onActivityResult method of calling Activity for example (from AndroidFileBrowserExampleActivity.java): 38 | ``` 39 | @Override 40 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 41 | // TODO Auto-generated method stub 42 | if (requestCode == REQUEST_CODE_PICK_FILE_TO_SAVE_INTERNAL) { 43 | if(resultCode == this.RESULT_OK) { 44 | String newDir = data.getStringExtra( 45 | ua.com.vassiliev.androidfilebrowser.FileBrowserActivity.returnDirectoryParameter); 46 | Toast.makeText( 47 | this, 48 | "Received path from file browser:"+newDir, 49 | Toast.LENGTH_LONG 50 | ).show(); 51 | } else {//if(resultCode == this.RESULT_OK) { 52 | Toast.makeText( 53 | this, 54 | "Received NO result from file browser", 55 | Toast.LENGTH_LONG) 56 | .show(); 57 | }//END } else {//if(resultCode == this.RESULT_OK) { 58 | }//if (requestCode == REQUEST_CODE_PICK_FILE_TO_SAVE_INTERNAL) { 59 | super.onActivityResult(requestCode, resultCode, data); 60 | } 61 | ``` 62 | 63 | Features 64 | At the moment only pick directory activity is provided, though more options are planned to be added in the future. 65 | 66 | Sometimes it is necessary to run Project/Clean for both this project and project(s) which rely on this to regenerate correct files/jars. 67 | 68 | License 69 | Licensed under the Apache License, Version 2.0 (the "License"); 70 | you may not use this file except in compliance with the License. 71 | You may obtain a copy of the License at 72 | 73 | http://www.apache.org/licenses/LICENSE-2.0 74 | 75 | Unless required by applicable law or agreed to in writing, software 76 | distributed under the License is distributed on an "AS IS" BASIS, 77 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 78 | See the License for the specific language governing permissions and 79 | limitations under the License. 80 | 81 | Thanks. 82 | This project is inspired and initially based on the project of Manish Burman - https://github.com/mburman/Android-File-Explore. 83 | 84 | 85 | 86 | 87 | [//]: <> (Author SHA-512: c46c48ddaccc53835237b551df240c1dc51ca78911fdec845481c04bb2bb438b71ed15431131850dd2654a136047dbe3129c728d4148f971d3bc0d7568124a86) -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-8 15 | android.library=true 16 | -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaal12/AndroidFileBrowser/1e31e1506185be317be140ed569696af6241d6e9/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-ldpi/dir_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaal12/AndroidFileBrowser/1e31e1506185be317be140ed569696af6241d6e9/res/drawable-ldpi/dir_up.png -------------------------------------------------------------------------------- /res/drawable-ldpi/file_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaal12/AndroidFileBrowser/1e31e1506185be317be140ed569696af6241d6e9/res/drawable-ldpi/file_icon.png -------------------------------------------------------------------------------- /res/drawable-ldpi/folder_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaal12/AndroidFileBrowser/1e31e1506185be317be140ed569696af6241d6e9/res/drawable-ldpi/folder_icon.png -------------------------------------------------------------------------------- /res/drawable-ldpi/folder_icon_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaal12/AndroidFileBrowser/1e31e1506185be317be140ed569696af6241d6e9/res/drawable-ldpi/folder_icon_light.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaal12/AndroidFileBrowser/1e31e1506185be317be140ed569696af6241d6e9/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaal12/AndroidFileBrowser/1e31e1506185be317be140ed569696af6241d6e9/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaal12/AndroidFileBrowser/1e31e1506185be317be140ed569696af6241d6e9/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 |