It’s a Java source code that can be easy integrated into your Android project. The source is for Eclipse but it can be also imported into Android Studio.
How to Integrate
1. Add permission into the AndroidManifest.xml:<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
2. Add chooser activity into the AndroidManifest.xml:
<activity android:name=".FileChooser" android:configChanges="orientation|..." />
3. Copy /res/values/file_chooser_strings.xml into your project.
4. Copy /res/layout/file_chooser.xml and /res/layout/file_chooser_item.xml into your project.
5. Copy all files from /res/drawable/ folder into your project.
Intent intent = new Intent(this, FileChooser.class); intent.putExtra("path", "/storage"); // path to opened folder intent.putExtra("showFiles", true); // show or hide files (true/false) intent.putExtra("returnFile", true); // return file or folder path (true/false) startActivityForResult(intent, CHOOSER_REQUEST_CODE);
7. Add code to get result from chooser:
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == CHOOSER_REQUEST_CODE) { String path = data.getStringExtra("path"); // returned path } }
from CodeCanyon new items
Download for Free
No comments:
Post a Comment