Skip to content
ChoosePhotoHelper develops a component which facilitates the source code of picking photos in your Android apps.
Kotlin Java Shell
Branch: master
Clone or download
Latest commit 59ed7d4 Aug 3, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle first commit May 21, 2019
java-sample-app Improving Design Jul 13, 2019
library Fixing Bitmap and Uri callback bug. Aug 3, 2019
sample-app Fixing Bitmap and Uri callback bug. Aug 3, 2019
.gitignore first commit May 21, 2019
LICENSE Initial commit May 20, 2019 Update Aug 3, 2019
build.gradle first commit May 21, 2019 first commit May 21, 2019
gradlew first commit May 21, 2019
gradlew.bat first commit May 21, 2019 first commit May 21, 2019
settings.gradle first commit May 21, 2019

ChoosePhotoHelper ⚡️

Android Arsenal Download

ChoosePhotoHelper develops a component which facilitates the source code of picking photos in your Android apps. By using it, it's possible to pick photos from gallery or take an image with the camera without any boilerplate codes. It also internally handles some issues like rotation correction of the taken photos, permission request for camera and gallery (if needed), etc.

Take a Photo Choose from Gallery


ChoosePhotoHelper is available on bintray to download using build tools systems. Add the following lines to your build.gradle file:

repositories {

dependencies {
    implementation 'com.aminography:choosephotohelper:1.0.2'


First of all, ChoosePhotoHelper provides 3 types of result to access the chosen photo which are:

Builder Method Result Type
asFilePath() String
asUri() Uri
asBitmap() Bitmap

Now, use it simply in 3 steps:

• First

Create an instance of ChoosePhotoHelper using its builder pattern specifying the result type:

choosePhotoHelper = ChoosePhotoHelper.with(activity)
        .build(new ChoosePhotoCallback<String>() {
            public void onChoose(String photo) {

• Second

Override onActivityResult and onRequestPermissionsResult in your Activity class, then forward their result to the choosePhotoHelper instance:

protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    choosePhotoHelper.onActivityResult(requestCode, resultCode, data);

public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    choosePhotoHelper.onRequestPermissionsResult(requestCode, permissions, grantResults);

• Finally

Call showChooser() method on the choosePhotoHelper instance:


Here is a detailed example which is written in kotlin:

class MainActivity : AppCompatActivity() {

    private lateinit var choosePhotoHelper: ChoosePhotoHelper

    override fun onCreate(savedInstanceState: Bundle?) {

        choosePhotoHelper = ChoosePhotoHelper.with(this)
            .build(ChoosePhotoCallback {

        button.setOnClickListener {

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        choosePhotoHelper.onActivityResult(requestCode, resultCode, data)

    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        choosePhotoHelper.onRequestPermissionsResult(requestCode, permissions, grantResults)



Copyright 2019 Mohammad Amin Hassani.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.