Polaris is a file chooser for Android
- Use it in Activity or Fragment
- Choose All files
- Custom themes
- Custom file extension icon
Images | FileSystem |
---|---|
![]() |
![]() |
- Add the JitPack repository to your build file
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
- Add the dependency
dependencies {
implementation 'cn.quickits:Polaris:0.2.1'
}
The library requires two permissions:
android.permission.READ_EXTERNAL_STORAGE
android.permission.WRITE_EXTERNAL_STORAGE
So if you are targeting Android 6.0+, you need to handle runtime permission request before next step.
Start PolarisActivity
from current Activity
or Fragment
:
Polaris.from(this).forResult(REQUEST_CODE_CHOOSE)
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_CODE_CHOOSE && resultCode == Activity.RESULT_OK) {
val uris = Polaris.obtainResult(data)
val paths = Polaris.obtainPathResult(data)
}
}
This library is inspired by Matisse & Charles and uses some of its source code.
Apache License Version 2.0
Copyright (c) 2018-present, GavinLiu