EasyImagePicker allow us to pick image from camera or gallery without creating a lot of boilerplate code .it support Android 10 version
- Runtime Permissions for camera and Gallery built in
- Camera Integration
- Less line of code to implement this
- File Provider
- Custom Picker Dialog
- Dialog animations
- Open File picker
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Just add it to your dependencies
implementation 'com.github.MuhammadTouseeq:EasyImagePicker:v1.0.3'
implementation 'com.karumi:dexter:4.2.0'
EasyImagePicker.getInstance().withContext(this, BuildConfig.APPLICATION_ID).openEasyPicker();
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
EasyImagePicker.getInstance().passActivityResult(requestCode, resultCode, data, new EasyImagePicker.easyPickerCallback() {
@Override
public void onMediaFilePicked(String result) {
}
@Override
public void onFailed(String error) {
Toast.makeText(MainActivity.this, "Error :"+error, Toast.LENGTH_SHORT).show();
}
});
}
EasyImagePicker.getInstance().withContext(this, BuildConfig.APPLICATION_ID).openCamera();
EasyImagePicker.getInstance().withContext(this, BuildConfig.APPLICATION_ID).openGallery();
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_path" />
</provider>
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.